| Function (anonymous_1) | |
|---|---|
| ✓ Was called | var Checker = function() {··· StringChecker.apply(this, arguments); }; |
| Function (anonymous_2) | |
|---|---|
| ✓ Was called | Checker.prototype.configure = function(/*config*/) {··· StringChecker.prototype.configure.apply(this, arguments); this._fileExtensions = this._configuration.getFileExtensions(); }; |
| Function (anonymous_3) | |
|---|---|
| ✓ Was called | Checker.prototype.checkFile = function(path) {··· if (this._configuration.isFileExcluded(path)) { return Vow.resolve(null); } return vowFs.read(path, 'utf8').then(function(data) { return this.checkString(data, path); }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._configuration.isFileExcluded(path)) {··· return Vow.resolve(null); } |
| ✓ Negative was executed (else) | }··· return vowFs.read(path, 'utf8').then(function(data) { |
| Function (anonymous_4) | |
|---|---|
| ✓ Was called | return vowFs.read(path, 'utf8').then(function(data) {··· return this.checkString(data, path); }, this); |
| Function (anonymous_5) | |
|---|---|
| ✓ Was called | Checker.prototype.fixFile = function(path) {··· if (this._configuration.isFileExcluded(path)) { return Vow.resolve(null); } return vowFs.read(path, 'utf8').then(function(data) { var result = this.fixString(data, path); return vowFs.write(path, result.output).then(function() { return result.errors; }); }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._configuration.isFileExcluded(path)) {··· return Vow.resolve(null); } |
| ✓ Negative was executed (else) | }··· return vowFs.read(path, 'utf8').then(function(data) { |
| Function (anonymous_6) | |
|---|---|
| ✓ Was called | return vowFs.read(path, 'utf8').then(function(data) {··· var result = this.fixString(data, path); return vowFs.write(path, result.output).then(function() { return result.errors; }); }, this); |
| Function (anonymous_7) | |
|---|---|
| ✓ Was called | return vowFs.write(path, result.output).then(function() {··· return result.errors; }); |
| Function (anonymous_8) | |
|---|---|
| ✓ Was called | Checker.prototype.checkDirectory = function(path) {··· return this._processDirectory(path, this.checkFile.bind(this)); }; |
| Function (anonymous_9) | |
|---|---|
| ✓ Was called | Checker.prototype.checkPath = function(path) {··· return this._processPath(path, this.checkFile.bind(this)); }; |
| Function (anonymous_10) | |
|---|---|
| ✓ Was called | Checker.prototype.fixPath = function(path) {··· return this._processPath(path, this.fixFile.bind(this)); }; |
| Function (anonymous_11) | |
|---|---|
| ✓ Was called | Checker.prototype._processDirectory = function(path, fileHandler) {··· return vowFs.listDir(path).then(function(filenames) { return Vow.all(filenames.map(function(filename) { var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { return []; } return Vow.when(fileHandler(fullname)).then(function(errors) { if (errors) { return errors; } return []; }); }, this); }, this)).then(function(results) { return [].concat.apply([], results); }); }, this); }; |
| Function (anonymous_12) | |
|---|---|
| ✓ Was called | return vowFs.listDir(path).then(function(filenames) {··· return Vow.all(filenames.map(function(filename) { var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { return []; } return Vow.when(fileHandler(fullname)).then(function(errors) { if (errors) { return errors; } return []; }); }, this); }, this)).then(function(results) { return [].concat.apply([], results); }); }, this); |
| Function (anonymous_13) | |
|---|---|
| ✓ Was called | return Vow.all(filenames.map(function(filename) {··· var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { return []; } return Vow.when(fileHandler(fullname)).then(function(errors) { if (errors) { return errors; } return []; }); }, this); }, this)).then(function(results) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._configuration.isFileExcluded(fullname)) {··· return []; } |
| ✓ Negative was executed (else) | }··· return vowFs.stat(fullname).then(function(stat) { |
| Function (anonymous_14) | |
|---|---|
| ✓ Was called | return vowFs.stat(fullname).then(function(stat) {··· if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { return []; } return Vow.when(fileHandler(fullname)).then(function(errors) { if (errors) { return errors; } return []; }); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (stat.isDirectory()) {··· return this._processDirectory(fullname, fileHandler); } |
| ✓ Negative was executed (else) | }··· if (!this._hasCorrectExtension(fullname)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!this._hasCorrectExtension(fullname)) {··· return []; } |
| ✓ Negative was executed (else) | }··· return Vow.when(fileHandler(fullname)).then(function(errors) { |
| Function (anonymous_15) | |
|---|---|
| ✓ Was called | return Vow.when(fileHandler(fullname)).then(function(errors) {··· if (errors) { return errors; } return []; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errors) {··· return errors; } |
| ✗ Negative was not executed (else) | }··· return []; |
| Function (anonymous_16) | |
|---|---|
| ✓ Was called | }, this)).then(function(results) {··· return [].concat.apply([], results); }); |
| Function (anonymous_17) | |
|---|---|
| ✓ Was called | Checker.prototype._processPath = function(path, fileHandler) {··· path = path.replace(/\/$/, ''); var _this = this; return vowFs.exists(path).then(function(exists) { if (!exists) { throw new Error('Path ' + path + ' was not found.'); } return vowFs.stat(path).then(function(stat) { if (stat.isDirectory()) { return _this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }); }); }; |
| Function (anonymous_18) | |
|---|---|
| ✓ Was called | return vowFs.exists(path).then(function(exists) {··· if (!exists) { throw new Error('Path ' + path + ' was not found.'); } return vowFs.stat(path).then(function(stat) { if (stat.isDirectory()) { return _this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }); }); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (!exists) {··· throw new Error('Path ' + path + ' was not found.'); } |
| ✓ Negative was executed (else) | }··· return vowFs.stat(path).then(function(stat) { |
| Function (anonymous_19) | |
|---|---|
| ✓ Was called | return vowFs.stat(path).then(function(stat) {··· if (stat.isDirectory()) { return _this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (stat.isDirectory()) {··· return _this._processDirectory(path, fileHandler); } |
| ✓ Negative was executed (else) | }··· return fileHandler(path).then(function(errors) { |
| Function (anonymous_20) | |
|---|---|
| ✓ Was called | return fileHandler(path).then(function(errors) {··· if (errors) { return [errors]; } return []; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errors) {··· return [errors]; } |
| ✗ Negative was not executed (else) | }··· return []; |
| Function (anonymous_21) | |
|---|---|
| ✓ Was called | Checker.prototype.checkStdin = function() {··· return this._processStdin(this.checkString.bind(this)); }; |
| Function (anonymous_22) | |
|---|---|
| ✓ Was called | Checker.prototype.fixStdin = function() {··· return this._processStdin(this.fixString.bind(this)); }; |
| Function (anonymous_23) | |
|---|---|
| ✓ Was called | Checker.prototype._processStdin = function(stdinHandler) {··· var stdInput = []; var deferred = Vow.defer(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function(chunk) { stdInput.push(chunk); }); process.stdin.on('end', function() { deferred.resolve(stdinHandler(stdInput.join(''))); }); return deferred.promise(); }; |
| Function (anonymous_24) | |
|---|---|
| ✓ Was called | process.stdin.on('data', function(chunk) {··· stdInput.push(chunk); }); |
| Function (anonymous_25) | |
|---|---|
| ✓ Was called | process.stdin.on('end', function() {··· deferred.resolve(stdinHandler(stdInput.join(''))); }); |
| Function (anonymous_26) | |
|---|---|
| ✓ Was called | Checker.prototype._hasCorrectExtension = function(testPath) {··· var extension = path.extname(testPath).toLowerCase(); var basename = path.basename(testPath).toLowerCase(); return !( this._fileExtensions.indexOf(extension) < 0 && this._fileExtensions.indexOf(basename) < 0 && this._fileExtensions.indexOf('*') < 0 ); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._fileExtensions.indexOf('*') < 0 |
| ✓ Was returned | this._fileExtensions.indexOf(extension) < 0 &&··· this._fileExtensions.indexOf(basename) < 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | this._fileExtensions.indexOf(basename) < 0 && |
| ✓ Was returned | this._fileExtensions.indexOf(extension) < 0 && |
| Function (anonymous_27) | |
|---|---|
| ✓ Was called | Checker.prototype._createConfiguration = function() {··· return new NodeConfiguration(); }; |
| Function (anonymous_28) | |
|---|---|
| ✓ Was called | var StringChecker = function(options) {··· this._configuredRules = []; this._errorsFound = 0; this._maxErrorsExceeded = false; this._configuration = this._createConfiguration(); this._configuration.registerDefaultPresets(); if (typeof options === 'boolean') { this._verbose = options; } else { options = options || {}; this._verbose = options.verbose || false; this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); } }; |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (typeof options === 'boolean') {··· this._verbose = options; } else { |
| ✓ Negative was executed (else) | } else {··· options = options || {}; this._verbose = options.verbose || false; this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options = options || {}; |
| ✓ Was returned | options = options || {}; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._verbose = options.verbose || false; |
| ✓ Was returned | this._verbose = options.verbose || false; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); |
| ✓ Was returned | this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); |
| Branch ConditionalExpression | |
| ✓ Positive was returned (? ...) | this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); |
| ✓ Negative was returned (: ...) | this._esprima = options.esprima || (options.esnext ? harmonyEsprima : defaultEsprima); |
| Function (anonymous_29) | |
|---|---|
| ✓ Was called | registerRule: function(rule) {··· this._configuration.registerRule(rule); }, |
| Function (anonymous_30) | |
|---|---|
| ✓ Was called | registerDefaultRules: function() {··· this._configuration.registerDefaultRules(); }, |
| Function (anonymous_31) | |
|---|---|
| ✗ Was not called | getProcessedConfig: function() {··· return this._configuration.getProcessedConfig(); }, |
| Function (anonymous_32) | |
|---|---|
| ✓ Was called | configure: function(config) {··· this._configuration.load(config); if (this._configuration.hasCustomEsprima()) { this._esprima = this._configuration.getCustomEsprima(); } else if (this._configuration.isESNextEnabled()) { this._esprima = harmonyEsprima; } if (this._verbose === false) { this._verbose = this._configuration.getVerbose(); } this._configuredRules = this._configuration.getConfiguredRules(); this._maxErrors = this._configuration.getMaxErrors(); }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (this._configuration.hasCustomEsprima()) {··· this._esprima = this._configuration.getCustomEsprima(); } else if (this._configuration.isESNextEnabled()) { |
| ✓ Negative was executed (else) | } else if (this._configuration.isESNextEnabled()) {··· this._esprima = harmonyEsprima; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (this._configuration.isESNextEnabled()) {··· this._esprima = harmonyEsprima; } |
| ✓ Negative was executed (else) | }··· if (this._verbose === false) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._verbose === false) {··· this._verbose = this._configuration.getVerbose(); } |
| ✓ Negative was executed (else) | }··· this._configuredRules = this._configuration.getConfiguredRules(); |
| Function (anonymous_33) | |
|---|---|
| ✓ Was called | checkString: function(source, filename) {··· filename = filename || 'input'; var sourceTree; var parseError; try { sourceTree = JsFile.parse(source, this._esprima, this._configuration.getEsprimaOptions()); } catch (e) { parseError = e; } var file = this._createJsFileInstance(filename, source, sourceTree); var errors = new Errors(file, this._verbose); if (this._maxErrorsExceeded) { return errors; } if (parseError) { this._addParseError(errors, parseError); return errors; } this._checkJsFile(file, errors); return errors; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | filename = filename || 'input'; |
| ✓ Was returned | filename = filename || 'input'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._maxErrorsExceeded) {··· return errors; } |
| ✓ Negative was executed (else) | }··· if (parseError) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parseError) {··· this._addParseError(errors, parseError); return errors; } |
| ✓ Negative was executed (else) | }··· this._checkJsFile(file, errors); |
| Function (anonymous_34) | |
|---|---|
| ✓ Was called | _checkJsFile: function(file, errors) {··· if (this._maxErrorsExceeded) { return; } var errorFilter = this._configuration.getErrorFilter(); this._configuredRules.forEach(function(rule) { errors.setCurrentRule(rule.getOptionName()); try { rule.check(file, errors); } catch (e) { errors.add('Error running rule ' + rule.getOptionName() + ': ' + 'This is an issue with JSCS and not your codebase.\n' + 'Please file an issue (with the stack trace below) at: ' + 'https://github.com/jscs-dev/node-jscs/issues/new\n' + e.stack, 1, 0); } }, this); this._configuration.getUnsupportedRuleNames().forEach(function(rulename) { errors.add('Unsupported rule: ' + rulename, 1, 0); }); // sort errors list to show errors as they appear in source errors.getErrorList().sort(function(a, b) { return (a.line - b.line) || (a.column - b.column); }); if (errorFilter) { errors.filter(errorFilter); } if (this._maxErrorsEnabled()) { this._maxErrorsExceeded = this._errorsFound + errors.getErrorCount() > this._maxErrors; errors.stripErrorList(Math.max(0, this._maxErrors - this._errorsFound)); } this._errorsFound += errors.getErrorCount(); }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (this._maxErrorsExceeded) {··· return; } |
| ✓ Negative was executed (else) | }··· var errorFilter = this._configuration.getErrorFilter(); |
| Function (anonymous_35) | |
|---|---|
| ✓ Was called | this._configuredRules.forEach(function(rule) {··· errors.setCurrentRule(rule.getOptionName()); try { rule.check(file, errors); } catch (e) { errors.add('Error running rule ' + rule.getOptionName() + ': ' + 'This is an issue with JSCS and not your codebase.\n' + 'Please file an issue (with the stack trace below) at: ' + 'https://github.com/jscs-dev/node-jscs/issues/new\n' + e.stack, 1, 0); } }, this); |
| Function (anonymous_36) | |
|---|---|
| ✓ Was called | this._configuration.getUnsupportedRuleNames().forEach(function(rulename) {··· errors.add('Unsupported rule: ' + rulename, 1, 0); }); |
| Function (anonymous_37) | |
|---|---|
| ✓ Was called | errors.getErrorList().sort(function(a, b) {··· return (a.line - b.line) || (a.column - b.column); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return (a.line - b.line) || (a.column - b.column); |
| ✓ Was returned | return (a.line - b.line) || (a.column - b.column); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errorFilter) {··· errors.filter(errorFilter); } |
| ✓ Negative was executed (else) | }··· if (this._maxErrorsEnabled()) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._maxErrorsEnabled()) {··· this._maxErrorsExceeded = this._errorsFound + errors.getErrorCount() > this._maxErrors; errors.stripErrorList(Math.max(0, this._maxErrors - this._errorsFound)); } |
| ✓ Negative was executed (else) | }··· this._errorsFound += errors.getErrorCount(); |
| Function (anonymous_38) | |
|---|---|
| ✓ Was called | _addParseError: function(errors, parseError) {··· if (this._maxErrorsExceeded) { return; } errors.setCurrentRule('parseError'); errors.add(parseError.description, parseError.lineNumber, parseError.column); if (this._maxErrorsEnabled()) { this._errorsFound += 1; this._maxErrorsExceeded = this._errorsFound >= this._maxErrors; } }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (this._maxErrorsExceeded) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.setCurrentRule('parseError'); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (this._maxErrorsEnabled()) {··· this._errorsFound += 1; this._maxErrorsExceeded = this._errorsFound >= this._maxErrors; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_39) | |
|---|---|
| ✓ Was called | _createJsFileInstance: function(filename, source, sourceTree) {··· return new JsFile(filename, source, sourceTree, { es3: this._configuration.isES3Enabled(), es6: this._configuration.isESNextEnabled() }); }, |
| Function (anonymous_40) | |
|---|---|
| ✓ Was called | fixString: function(source, filename) {··· if (this._maxErrorsEnabled()) { throw new Error('Cannot autofix when `maxError` option is enabled'); } filename = filename || 'input'; var sourceTree; var parseError; try { sourceTree = JsFile.parse(source, this._esprima, this._configuration.getEsprimaOptions()); } catch (e) { parseError = e; } if (parseError) { var parseErrors = new Errors(this._createJsFileInstance(filename, source, sourceTree), this._verbose); this._addParseError(parseErrors, parseError); return {output: source, errors: parseErrors}; } else { var attempt = 0; var errors; var file; do { file = this._createJsFileInstance(filename, source, sourceTree); errors = new Errors(file, this._verbose); // Changes to current sources are made in rules through assertions. this._checkJsFile(file, errors); var hasFixes = errors.getErrorList().some(function(err) { return err.fixed; }); if (!hasFixes) { break; } source = file.render(); sourceTree = JsFile.parse(source, this._esprima, this._configuration.getEsprimaOptions()); attempt++; } while (attempt < MAX_FIX_ATTEMPTS); return {output: source, errors: errors}; } }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (this._maxErrorsEnabled()) {··· throw new Error('Cannot autofix when `maxError` option is enabled'); } |
| ✓ Negative was executed (else) | }··· filename = filename || 'input'; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | filename = filename || 'input'; |
| ✓ Was returned | filename = filename || 'input'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parseError) {··· var parseErrors = new Errors(this._createJsFileInstance(filename, source, sourceTree), this._verbose); this._addParseError(parseErrors, parseError); return {output: source, errors: parseErrors}; } else { |
| ✓ Negative was executed (else) | } else {··· var attempt = 0; var errors; var file; do { file = this._createJsFileInstance(filename, source, sourceTree); errors = new Errors(file, this._verbose); // Changes to current sources are made in rules through assertions. this._checkJsFile(file, errors); var hasFixes = errors.getErrorList().some(function(err) { return err.fixed; }); if (!hasFixes) { break; } source = file.render(); sourceTree = JsFile.parse(source, this._esprima, this._configuration.getEsprimaOptions()); attempt++; } while (attempt < MAX_FIX_ATTEMPTS); return {output: source, errors: errors}; } |
| Function (anonymous_41) | |
|---|---|
| ✓ Was called | var hasFixes = errors.getErrorList().some(function(err) {··· return err.fixed; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!hasFixes) {··· break; } |
| ✓ Negative was executed (else) | }··· source = file.render(); |
| Function (anonymous_42) | |
|---|---|
| ✓ Was called | _maxErrorsEnabled: function() {··· return this._maxErrors !== null && !isNaN(this._maxErrors); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return this._maxErrors !== null && !isNaN(this._maxErrors); |
| ✓ Was returned | return this._maxErrors !== null && !isNaN(this._maxErrors); |
| Function (anonymous_43) | |
|---|---|
| ✗ Was not called | maxErrorsExceeded: function() {··· return this._maxErrorsExceeded; }, |
| Function (anonymous_44) | |
|---|---|
| ✓ Was called | _createConfiguration: function() {··· return new Configuration(); }, |
| Function (anonymous_45) | |
|---|---|
| ✗ Was not called | getConfiguration: function() {··· return this._configuration; } |
| Function (anonymous_46) | |
|---|---|
| ✓ Was called | var Errors = function(file, verbose) {··· this._errorList = []; this._file = file; this._currentRule = ''; this._verbose = verbose || false; /** * @type {TokenAssert} * @public */ this.assert = new TokenAssert(file); this.assert.on('error', this._addError.bind(this)); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._verbose = verbose || false; |
| ✓ Was returned | this._verbose = verbose || false; |
| Function (anonymous_47) | |
|---|---|
| ✓ Was called | add: function(message, line, column) {··· if (typeof line === 'object') { column = line.column; line = line.line; } // line and column numbers should be explicit assert(typeof line === 'number' && line > 0, 'Unable to add an error, `line` should be a number greater than 0 but ' + line + ' given'); assert(typeof column === 'number' && column >= 0, 'Unable to add an error, `column` should be a positive number but ' + column + ' given'); this._addError({ message: message, line: line, column: column }); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof line === 'object') {··· column = line.column; line = line.line; } |
| ✓ Negative was executed (else) | }··· // line and column numbers should be explicit |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(typeof line === 'number' && line > 0, |
| ✓ Was returned | assert(typeof line === 'number' && line > 0, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(typeof column === 'number' && column >= 0, |
| ✓ Was returned | assert(typeof column === 'number' && column >= 0, |
| Function (anonymous_48) | |
|---|---|
| ✓ Was called | _addError: function(errorInfo) {··· if (!this._file.isEnabledRule(this._currentRule, errorInfo.line)) { return; } this._errorList.push({ filename: this._file.getFilename(), rule: this._currentRule, message: this._prepareMessage(errorInfo), line: errorInfo.line, column: errorInfo.column, fixed: errorInfo.fixed }); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!this._file.isEnabledRule(this._currentRule, errorInfo.line)) {··· return; } |
| ✓ Negative was executed (else) | }··· this._errorList.push({ |
| Function (anonymous_49) | |
|---|---|
| ✓ Was called | _prepareMessage: function(errorInfo) {··· if (this._verbose && this._currentRule) { return this._currentRule + ': ' + errorInfo.message; } return errorInfo.message; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._verbose && this._currentRule) {··· return this._currentRule + ': ' + errorInfo.message; } |
| ✓ Negative was executed (else) | }··· return errorInfo.message; |
| Branch LogicalExpression | |
| ✓ Was returned | if (this._verbose && this._currentRule) { |
| ✓ Was returned | if (this._verbose && this._currentRule) { |
| Function (anonymous_50) | |
|---|---|
| ✓ Was called | getErrorList: function() {··· return this._errorList; }, |
| Function (anonymous_51) | |
|---|---|
| ✓ Was called | getFilename: function() {··· return this._file.getFilename(); }, |
| Function (anonymous_52) | |
|---|---|
| ✓ Was called | isEmpty: function() {··· return this._errorList.length === 0; }, |
| Function (anonymous_53) | |
|---|---|
| ✓ Was called | getErrorCount: function() {··· return this._errorList.length; }, |
| Function (anonymous_54) | |
|---|---|
| ✓ Was called | stripErrorList: function(length) {··· this._errorList.splice(length); }, |
| Function (anonymous_55) | |
|---|---|
| ✓ Was called | filter: function(filter) {··· this._errorList = this._errorList.filter(filter); }, |
| Function (anonymous_56) | |
|---|---|
| ✓ Was called | explainError: function(error, colorize) {··· var lineNumber = error.line - 1; var lines = this._file.getLines(); var result = [ renderLine(lineNumber, lines[lineNumber], colorize), renderPointer(error.column, colorize) ]; var i = lineNumber - 1; var linesAround = 2; while (i >= 0 && i >= (lineNumber - linesAround)) { result.unshift(renderLine(i, lines[i], colorize)); i--; } i = lineNumber + 1; while (i < lines.length && i <= (lineNumber + linesAround)) { result.push(renderLine(i, lines[i], colorize)); i++; } result.unshift(formatErrorMessage(error.message, this.getFilename(), colorize)); return result.join('\n'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | while (i >= 0 && i >= (lineNumber - linesAround)) { |
| ✓ Was returned | while (i >= 0 && i >= (lineNumber - linesAround)) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | while (i < lines.length && i <= (lineNumber + linesAround)) { |
| ✓ Was returned | while (i < lines.length && i <= (lineNumber + linesAround)) { |
| Function (anonymous_57) | |
|---|---|
| ✓ Was called | setCurrentRule: function(rule) {··· this._currentRule = rule; } |
| Function formatErrorMessage | |
|---|---|
| ✓ Was called | function formatErrorMessage(message, filename, colorize) {··· return (colorize ? chalk.bold(message) : message) + ' at ' + (colorize ? chalk.green(filename) : filename) + ' :'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return (colorize ? chalk.bold(message) : message) + |
| ✓ Negative was returned (: ...) | return (colorize ? chalk.bold(message) : message) + |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | (colorize ? chalk.green(filename) : filename) + ' :'; |
| ✓ Negative was returned (: ...) | (colorize ? chalk.green(filename) : filename) + ' :'; |
| Function prependSpaces | |
|---|---|
| ✓ Was called | function prependSpaces(s, len) {··· while (s.length < len) { s = ' ' + s; } return s; } |
| Function renderLine | |
|---|---|
| ✓ Was called | function renderLine(n, line, colorize) {··· // Convert tabs to spaces, so errors in code lines with tabs as indention symbol // could be correctly rendered, plus it will provide less verbose output line = line.replace(/\t/g, ' '); // "n + 1" to print lines in human way (counted from 1) var lineNumber = prependSpaces((n + 1).toString(), 5) + ' |'; return ' ' + (colorize ? chalk.grey(lineNumber) : lineNumber) + line; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return ' ' + (colorize ? chalk.grey(lineNumber) : lineNumber) + line; |
| ✓ Negative was returned (: ...) | return ' ' + (colorize ? chalk.grey(lineNumber) : lineNumber) + line; |
| Function renderPointer | |
|---|---|
| ✓ Was called | function renderPointer(column, colorize) {··· var res = (new Array(column + 9)).join('-') + '^'; return colorize ? chalk.grey(res) : res; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return colorize ? chalk.grey(res) : res; |
| ✓ Negative was returned (: ...) | return colorize ? chalk.grey(res) : res; |
| Function TokenAssert | |
|---|---|
| ✓ Was called | function TokenAssert(file) {··· EventEmitter.call(this); this._file = file; } |
| Function (anonymous_63) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.whitespaceBetween = function(options) {··· options.atLeast = 1; this.spacesBetween(options); }; |
| Function (anonymous_64) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.noWhitespaceBetween = function(options) {··· options.exactly = 0; this.spacesBetween(options); }; |
| Function (anonymous_65) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.spacesBetween = function(options) {··· var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (!token || !nextToken) { return; } this._validateOptions(options); if (!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) { return; } // Only attempt to remove or add lines if there are no comments between the two nodes // as this prevents accidentally moving a valid token onto a line comment ed line var fixed = this._file.getNextToken(options.token, {includeComments: true}) === nextToken; var emitError = function(countPrefix, spaceCount) { if (fixed) { nextToken.whitespaceBefore = new Array(spaceCount + 1).join(' '); } var msgPostfix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); var spacesBetween = Math.abs(nextToken.range[0] - token.range[1]); if (atLeast !== undefined && spacesBetween < atLeast) { emitError('at least', atLeast); } else if (atMost !== undefined && spacesBetween > atMost) { emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { emitError('exactly', exactly); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!token || !nextToken) {··· return; } |
| ✓ Negative was executed (else) | }··· this._validateOptions(options); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!token || !nextToken) { |
| ✓ Was returned | if (!token || !nextToken) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) {··· return; } |
| ✓ Negative was executed (else) | }··· // Only attempt to remove or add lines if there are no comments between the two nodes |
| Branch LogicalExpression | |
| ✓ Was returned | if (!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) { |
| ✓ Was returned | if (!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) { |
| Function (anonymous_66) | |
|---|---|
| ✓ Was called | var emitError = function(countPrefix, spaceCount) {··· if (fixed) { nextToken.whitespaceBefore = new Array(spaceCount + 1).join(' '); } var msgPostfix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (fixed) {··· nextToken.whitespaceBefore = new Array(spaceCount + 1).join(' '); } |
| ✓ Negative was executed (else) | }··· var msgPostfix = token.value + ' and ' + nextToken.value; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!options.message) {··· if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } |
| ✓ Negative was executed (else) | }··· this.emit('error', { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (exactly === 0) {··· // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { |
| ✓ Negative was executed (else) | } else if (exactly !== undefined) {··· // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (exactly !== undefined) {··· // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Negative was executed (else) | } else if (atLeast === 1 && atMost === undefined) {··· // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (atLeast === 1 && atMost === undefined) {··· // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { |
| ✓ Negative was executed (else) | } else {··· options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Was returned | } else if (atLeast === 1 && atMost === undefined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (atLeast !== undefined && spacesBetween < atLeast) {··· emitError('at least', atLeast); } else if (atMost !== undefined && spacesBetween > atMost) { |
| ✓ Negative was executed (else) | } else if (atMost !== undefined && spacesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (atLeast !== undefined && spacesBetween < atLeast) { |
| ✓ Was returned | if (atLeast !== undefined && spacesBetween < atLeast) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (atMost !== undefined && spacesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { |
| ✓ Negative was executed (else) | } else if (exactly !== undefined && spacesBetween !== exactly) {··· emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (atMost !== undefined && spacesBetween > atMost) { |
| ✓ Was returned | } else if (atMost !== undefined && spacesBetween > atMost) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (exactly !== undefined && spacesBetween !== exactly) {··· emitError('exactly', exactly); } |
| ✓ Negative was executed (else) | }··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (exactly !== undefined && spacesBetween !== exactly) { |
| ✓ Was returned | } else if (exactly !== undefined && spacesBetween !== exactly) { |
| Function (anonymous_67) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.indentation = function(options) {··· var lineNumber = options.lineNumber; var actual = options.actual; var expected = options.expected; var indentChar = options.indentChar; if (actual === expected) { return; } if (!options.silent) { this.emit('error', { message: 'Expected indentation of ' + expected + ' characters', line: lineNumber, column: expected, fixed: true }); } var token = this._file.getFirstTokenOnLine(lineNumber, {includeComments: true}); var newWhitespace = (new Array(expected + 1)).join(indentChar); if (!token) { this._setEmptyLineIndentation(lineNumber, newWhitespace); return; } this._updateWhitespaceByLine(token, function(lines) { lines[lines.length - 1] = newWhitespace; return lines; }); if (token.isComment) { this._updateCommentWhitespace(token, indentChar, actual, expected); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (actual === expected) {··· return; } |
| ✓ Negative was executed (else) | }··· if (!options.silent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!options.silent) {··· this.emit('error', { message: 'Expected indentation of ' + expected + ' characters', line: lineNumber, column: expected, fixed: true }); } |
| ✓ Negative was executed (else) | }··· var token = this._file.getFirstTokenOnLine(lineNumber, {includeComments: true}); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!token) {··· this._setEmptyLineIndentation(lineNumber, newWhitespace); return; } |
| ✓ Negative was executed (else) | }··· this._updateWhitespaceByLine(token, function(lines) { |
| Function (anonymous_68) | |
|---|---|
| ✓ Was called | this._updateWhitespaceByLine(token, function(lines) {··· lines[lines.length - 1] = newWhitespace; return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.isComment) {··· this._updateCommentWhitespace(token, indentChar, actual, expected); } |
| ✓ Negative was executed (else) | }··· }; |
| Function (anonymous_69) | |
|---|---|
| ✓ Was called | TokenAssert.prototype._updateWhitespaceByLine = function(token, callback) {··· var lineBreak = this._file.getLineBreakStyle(); var lines = token.whitespaceBefore.split(/\r\n|\r|\n/); lines = callback(lines); token.whitespaceBefore = lines.join(lineBreak); }; |
| Function (anonymous_70) | |
|---|---|
| ✓ Was called | TokenAssert.prototype._updateCommentWhitespace = function(token, indentChar, actual, expected) {··· var difference = expected - actual; var tokenLines = token.value.split(/\r\n|\r|\n/); var i = 1; if (difference >= 0) { var lineWhitespace = (new Array(difference + 1)).join(indentChar); for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; } } else { for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i].substring(-difference); } } token.value = tokenLines.join(this._file.getLineBreakStyle()); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (difference >= 0) {··· var lineWhitespace = (new Array(difference + 1)).join(indentChar); for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; } } else { |
| ✓ Negative was executed (else) | } else {··· for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i].substring(-difference); } } |
| Branch ConditionalExpression | |
|---|---|
| ✗ Positive was not returned (? ...) | tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; |
| ✓ Negative was returned (: ...) | tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; |
| Function (anonymous_71) | |
|---|---|
| ✓ Was called | TokenAssert.prototype._setEmptyLineIndentation = function(lineNumber, newWhitespace) {··· var token; do { token = this._file.getFirstTokenOnLine(++lineNumber, {includeComments: true}); } while (!token); this._updateWhitespaceByLine(token, function(lines) { if (lines[0] !== '') { lines[0] = newWhitespace; } for (var i = 1; i < lines.length; i++) { lines[i] = newWhitespace; } return lines; }); }; |
| Function (anonymous_72) | |
|---|---|
| ✓ Was called | this._updateWhitespaceByLine(token, function(lines) {··· if (lines[0] !== '') { lines[0] = newWhitespace; } for (var i = 1; i < lines.length; i++) { lines[i] = newWhitespace; } return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lines[0] !== '') {··· lines[0] = newWhitespace; } |
| ✓ Negative was executed (else) | }··· for (var i = 1; i < lines.length; i++) { |
| Function (anonymous_73) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.sameLine = function(options) {··· options.exactly = 0; this.linesBetween(options); }; |
| Function (anonymous_74) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.differentLine = function(options) {··· options.atLeast = 1; this.linesBetween(options); }; |
| Function (anonymous_75) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.linesBetween = function(options) {··· var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (!token || !nextToken) { return; } this._validateOptions(options); // Only attempt to remove or add lines if there are no comments between the two nodes // as this prevents accidentally moving a valid token onto a line comment ed line var fixed = this._file.getNextToken(options.token, {includeComments: true}) === nextToken; var linesBetween = Math.abs(token.loc.end.line - nextToken.loc.start.line); var emitError = function(countPrefix, lineCount) { var msgPrefix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } if (fixed) { this._augmentLineCount(options, lineCount); } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); if (atLeast !== undefined && linesBetween < atLeast) { emitError('at least', atLeast); } else if (atMost !== undefined && linesBetween > atMost) { emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { emitError('exactly', exactly); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!token || !nextToken) {··· return; } |
| ✓ Negative was executed (else) | }··· this._validateOptions(options); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!token || !nextToken) { |
| ✓ Was returned | if (!token || !nextToken) { |
| Function (anonymous_76) | |
|---|---|
| ✓ Was called | var emitError = function(countPrefix, lineCount) {··· var msgPrefix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } if (fixed) { this._augmentLineCount(options, lineCount); } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!options.message) {··· if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } |
| ✓ Negative was executed (else) | }··· if (fixed) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (exactly === 0) {··· // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Negative was executed (else) | } else if (atLeast === 1 && atMost === undefined) {··· // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (atLeast === 1 && atMost === undefined) {··· // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { |
| ✓ Negative was executed (else) | } else {··· // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Was returned | } else if (atLeast === 1 && atMost === undefined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (fixed) {··· this._augmentLineCount(options, lineCount); } |
| ✓ Negative was executed (else) | }··· this.emit('error', { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (atLeast !== undefined && linesBetween < atLeast) {··· emitError('at least', atLeast); } else if (atMost !== undefined && linesBetween > atMost) { |
| ✓ Negative was executed (else) | } else if (atMost !== undefined && linesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (atLeast !== undefined && linesBetween < atLeast) { |
| ✓ Was returned | if (atLeast !== undefined && linesBetween < atLeast) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (atMost !== undefined && linesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { |
| ✓ Negative was executed (else) | } else if (exactly !== undefined && linesBetween !== exactly) {··· emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (atMost !== undefined && linesBetween > atMost) { |
| ✓ Was returned | } else if (atMost !== undefined && linesBetween > atMost) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (exactly !== undefined && linesBetween !== exactly) {··· emitError('exactly', exactly); } |
| ✓ Negative was executed (else) | }··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (exactly !== undefined && linesBetween !== exactly) { |
| ✓ Was returned | } else if (exactly !== undefined && linesBetween !== exactly) { |
| Function (anonymous_77) | |
|---|---|
| ✓ Was called | TokenAssert.prototype._validateOptions = function(options) {··· var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (token === nextToken) { throw new Error('You cannot specify the same token as both token and nextToken'); } if (atLeast === undefined && atMost === undefined && exactly === undefined) { throw new Error('You must specify at least one option'); } if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { throw new Error('You cannot specify atLeast or atMost with exactly'); } if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { throw new Error('atLeast and atMost are in conflict'); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token === nextToken) {··· throw new Error('You cannot specify the same token as both token and nextToken'); } |
| ✓ Negative was executed (else) | }··· if (atLeast === undefined && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | exactly === undefined) {··· throw new Error('You must specify at least one option'); } |
| ✓ Negative was executed (else) | }··· if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| Branch LogicalExpression | |
| ✓ Was returned | exactly === undefined) { |
| ✓ Was returned | if (atLeast === undefined &&··· atMost === undefined && |
| Branch LogicalExpression | |
| ✓ Was returned | atMost === undefined && |
| ✓ Was returned | if (atLeast === undefined && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) {··· throw new Error('You cannot specify atLeast or atMost with exactly'); } |
| ✓ Negative was executed (else) | }··· if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| ✓ Was returned | if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| ✓ Was returned | if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) {··· throw new Error('atLeast and atMost are in conflict'); } |
| ✓ Negative was executed (else) | }··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| ✓ Was returned | if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| ✓ Was returned | if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Function (anonymous_78) | |
|---|---|
| ✓ Was called | TokenAssert.prototype._augmentLineCount = function(options, lineCount) {··· var token = options.nextToken; if (lineCount === 0) { if (options.stickToPreviousToken) { var nextToken = this._file.getNextToken(token, {includeComments: true}); nextToken.whitespaceBefore = token.whitespaceBefore; } token.whitespaceBefore = ' '; return; } this._updateWhitespaceByLine(token, function(lines) { var currentLineCount = lines.length; var lastLine = lines[lines.length - 1]; if (currentLineCount <= lineCount) { // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } return lines; }); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lineCount === 0) {··· if (options.stickToPreviousToken) { var nextToken = this._file.getNextToken(token, {includeComments: true}); nextToken.whitespaceBefore = token.whitespaceBefore; } token.whitespaceBefore = ' '; return; } |
| ✓ Negative was executed (else) | }··· this._updateWhitespaceByLine(token, function(lines) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.stickToPreviousToken) {··· var nextToken = this._file.getNextToken(token, {includeComments: true}); nextToken.whitespaceBefore = token.whitespaceBefore; } |
| ✓ Negative was executed (else) | }··· token.whitespaceBefore = ' '; |
| Function (anonymous_79) | |
|---|---|
| ✓ Was called | this._updateWhitespaceByLine(token, function(lines) {··· var currentLineCount = lines.length; var lastLine = lines[lines.length - 1]; if (currentLineCount <= lineCount) { // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (currentLineCount <= lineCount) {··· // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { |
| ✓ Negative was executed (else) | } else {··· // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } |
| Function (anonymous_80) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.tokenBefore = function(options) {··· var token = options.token; var actualTokenBefore = this._file.getPrevToken(token); var expectedTokenBefore = options.expectedTokenBefore; if (!actualTokenBefore) { this.emit('error', { message: expectedTokenBefore.value + ' was expected before ' + token.value + ' but document start found', line: token.loc.start.line, column: token.loc.start.column }); return; } if ( actualTokenBefore.type !== expectedTokenBefore.type || actualTokenBefore.value !== expectedTokenBefore.value ) { var message = options.message; if (!message) { var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } this.emit('error', { message: message, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column }); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!actualTokenBefore) {··· this.emit('error', { message: expectedTokenBefore.value + ' was expected before ' + token.value + ' but document start found', line: token.loc.start.line, column: token.loc.start.column }); return; } |
| ✓ Negative was executed (else) | }··· if ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· var message = options.message; if (!message) { var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } this.emit('error', { message: message, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column }); } |
| ✓ Negative was executed (else) | }··· }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | actualTokenBefore.value !== expectedTokenBefore.value |
| ✓ Was returned | actualTokenBefore.type !== expectedTokenBefore.type || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!message) {··· var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } |
| ✓ Negative was executed (else) | }··· this.emit('error', { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + |
| ✓ Negative was returned (: ...) | expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; |
| ✓ Negative was returned (: ...) | ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; |
| Function (anonymous_81) | |
|---|---|
| ✓ Was called | TokenAssert.prototype.noTokenBefore = function(options) {··· var token = options.token; var actualTokenBefore = this._file.getPrevToken(token); if (!actualTokenBefore) { // document start return; } var expectedTokenBefore = options.expectedTokenBefore; if (actualTokenBefore.type === expectedTokenBefore.type && actualTokenBefore.value === expectedTokenBefore.value ) { this.emit('error', { message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column }); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!actualTokenBefore) {··· // document start return; } |
| ✓ Negative was executed (else) | }··· var expectedTokenBefore = options.expectedTokenBefore; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· this.emit('error', { message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column }); } |
| ✓ Negative was executed (else) | }··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | actualTokenBefore.value === expectedTokenBefore.value |
| ✓ Was returned | if (actualTokenBefore.type === expectedTokenBefore.type && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, |
| ✓ Was returned | message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, |
| Function (anonymous_82) | |
|---|---|
| ✓ Was called | var JsFile = function(filename, source, tree, options) {··· options = options || {}; this._filename = filename; this._source = source; this._tree = tree || {tokens: [], comments: []}; this._es3 = options.es3 || false; this._es6 = options.es6 || false; this._lineBreaks = null; this._lines = source.split(/\r\n|\r|\n/); this._tree.tokens = this._fixEs6Tokens(this._tree.tokens); this._tokens = this._buildTokenList(this._tree.tokens, this._tree.comments); this._addEOFToken(); this._applyWhitespaceData(this._tokens, source); var tokenIndexes = this._buildTokenIndex(this._tokens); this._tokenRangeStartIndex = tokenIndexes.tokenRangeStartIndex; this._tokenRangeEndIndex = tokenIndexes.tokenRangeEndIndex; this._tokensByLineIndex = tokenIndexes.tokensByLineIndex; var nodeIndexes = this._buildNodeIndex(); this._index = nodeIndexes.nodesByType; this._nodesByStartRange = nodeIndexes.nodesByStartRange; this._fixEsprimaIdentifiers(); this._buildDisabledRuleIndex(); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options = options || {}; |
| ✓ Was returned | options = options || {}; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._tree = tree || {tokens: [], comments: []}; |
| ✓ Was returned | this._tree = tree || {tokens: [], comments: []}; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._es3 = options.es3 || false; |
| ✓ Was returned | this._es3 = options.es3 || false; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._es6 = options.es6 || false; |
| ✓ Was returned | this._es6 = options.es6 || false; |
| Function (anonymous_83) | |
|---|---|
| ✓ Was called | getLineBreakStyle: function() {··· var lineBreaks = this.getLineBreaks(); return lineBreaks.length ? lineBreaks[0] : '\n'; }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return lineBreaks.length ? lineBreaks[0] : '\n'; |
| ✓ Negative was returned (: ...) | return lineBreaks.length ? lineBreaks[0] : '\n'; |
| Function (anonymous_84) | |
|---|---|
| ✓ Was called | getLineBreaks: function() {··· if (this._lineBreaks === null) { this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; } return this._lineBreaks; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._lineBreaks === null) {··· this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; } |
| ✓ Negative was executed (else) | }··· return this._lineBreaks; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; |
| ✓ Was returned | this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; |
| Function (anonymous_85) | |
|---|---|
| ✓ Was called | _buildDisabledRuleIndex: function() {··· this._disabledRuleIndex = []; var comments = this.getComments(); var commentRe = /(jscs\s*:\s*(en|dis)able)(.*)/; comments.forEach(function(comment) { var enabled; var parsed = commentRe.exec(comment.value.trim()); if (!parsed || parsed.index !== 0) { return; } enabled = parsed[2] === 'en'; this._addToDisabledRuleIndex(enabled, parsed[3], comment.loc.start.line); }, this); }, |
| Function (anonymous_86) | |
|---|---|
| ✓ Was called | comments.forEach(function(comment) {··· var enabled; var parsed = commentRe.exec(comment.value.trim()); if (!parsed || parsed.index !== 0) { return; } enabled = parsed[2] === 'en'; this._addToDisabledRuleIndex(enabled, parsed[3], comment.loc.start.line); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!parsed || parsed.index !== 0) {··· return; } |
| ✓ Negative was executed (else) | }··· enabled = parsed[2] === 'en'; |
| Branch LogicalExpression | |
| ✓ Was returned | if (!parsed || parsed.index !== 0) { |
| ✓ Was returned | if (!parsed || parsed.index !== 0) { |
| Function (anonymous_87) | |
|---|---|
| ✓ Was called | isEnabledRule: function(ruleName, line) {··· var enabled = true; this._disabledRuleIndex.some(function(region) { // once the comment we're inspecting occurs after the location of the error, // no longer check for whether the state is enabled or disable if (region.line > line) { return true; } if (region.rule === ruleName || region.rule === '*') { enabled = region.enabled; } }, this); return enabled; }, |
| Function (anonymous_88) | |
|---|---|
| ✓ Was called | this._disabledRuleIndex.some(function(region) {··· // once the comment we're inspecting occurs after the location of the error, // no longer check for whether the state is enabled or disable if (region.line > line) { return true; } if (region.rule === ruleName || region.rule === '*') { enabled = region.enabled; } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (region.line > line) {··· return true; } |
| ✓ Negative was executed (else) | }··· if (region.rule === ruleName || region.rule === '*') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (region.rule === ruleName || region.rule === '*') {··· enabled = region.enabled; } |
| ✓ Negative was executed (else) | }··· }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | if (region.rule === ruleName || region.rule === '*') { |
| ✓ Was returned | if (region.rule === ruleName || region.rule === '*') { |
| Function (anonymous_89) | |
|---|---|
| ✓ Was called | _addToDisabledRuleIndex: function(enabled, rulesStr, line) {··· rulesStr = rulesStr || '*'; rulesStr.split(',').forEach(function(rule) { rule = rule.trim(); if (!rule) { return; } this._disabledRuleIndex.push({ rule: rule, enabled: enabled, line: line }); }, this); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | rulesStr = rulesStr || '*'; |
| ✓ Was returned | rulesStr = rulesStr || '*'; |
| Function (anonymous_90) | |
|---|---|
| ✓ Was called | rulesStr.split(',').forEach(function(rule) {··· rule = rule.trim(); if (!rule) { return; } this._disabledRuleIndex.push({ rule: rule, enabled: enabled, line: line }); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!rule) {··· return; } |
| ✓ Negative was executed (else) | }··· this._disabledRuleIndex.push({ |
| Function (anonymous_91) | |
|---|---|
| ✓ Was called | _buildTokenIndex: function(tokens) {··· var tokenRangeStartIndex = {}; var tokenRangeEndIndex = {}; var tokensByLineIndex = {}; for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; // tokens by range tokenRangeStartIndex[token.range[0]] = i; tokenRangeEndIndex[token.range[1]] = i; // tokens by line var lineNumber = token.loc.start.line; if (!tokensByLineIndex[lineNumber]) { tokensByLineIndex[lineNumber] = []; } tokensByLineIndex[lineNumber].push(token); token._tokenIndex = i; } return { tokenRangeStartIndex: tokenRangeStartIndex, tokenRangeEndIndex: tokenRangeEndIndex, tokensByLineIndex: tokensByLineIndex }; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!tokensByLineIndex[lineNumber]) {··· tokensByLineIndex[lineNumber] = []; } |
| ✓ Negative was executed (else) | }··· tokensByLineIndex[lineNumber].push(token); |
| Function (anonymous_92) | |
|---|---|
| ✓ Was called | getTokenByRangeStart: function(start) {··· var tokenIndex = this._tokenRangeStartIndex[start]; return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; |
| ✓ Negative was returned (: ...) | return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; |
| Function (anonymous_93) | |
|---|---|
| ✓ Was called | getTokenByRangeEnd: function(end) {··· var tokenIndex = this._tokenRangeEndIndex[end]; return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; |
| ✓ Negative was returned (: ...) | return tokenIndex === undefined ? undefined : this._tokens[tokenIndex]; |
| Function (anonymous_94) | |
|---|---|
| ✓ Was called | getFirstNodeToken: function(node) {··· return this.getTokenByRangeStart(node.range[0]); }, |
| Function (anonymous_95) | |
|---|---|
| ✓ Was called | getLastNodeToken: function(node) {··· return this.getTokenByRangeEnd(node.range[1]); }, |
| Function (anonymous_96) | |
|---|---|
| ✓ Was called | getFirstToken: function() {··· return this._tokens[0]; }, |
| Function (anonymous_97) | |
|---|---|
| ✓ Was called | getLastToken: function() {··· return this._tokens[this._tokens.length - 1]; }, |
| Function (anonymous_98) | |
|---|---|
| ✓ Was called | getPrevToken: function(token, options) {··· var index = token._tokenIndex - 1; if (index < 0) { return undefined; } if (options && options.includeComments) { return this._tokens[index]; } do { if (!this._tokens[index].isComment) { return this._tokens[index]; } } while (--index >= 0); return undefined; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (index < 0) {··· return undefined; } |
| ✓ Negative was executed (else) | }··· if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options && options.includeComments) {··· return this._tokens[index]; } |
| ✓ Negative was executed (else) | }··· do { |
| Branch LogicalExpression | |
| ✓ Was returned | if (options && options.includeComments) { |
| ✓ Was returned | if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!this._tokens[index].isComment) {··· return this._tokens[index]; } |
| ✓ Negative was executed (else) | }··· } while (--index >= 0); |
| Function (anonymous_99) | |
|---|---|
| ✓ Was called | getNextToken: function(token, options) {··· var index = token._tokenIndex + 1; if (index >= this._tokens.length) { return undefined; } if (options && options.includeComments) { return this._tokens[index]; } do { if (!this._tokens[index].isComment) { return this._tokens[index]; } } while (++index < this._tokens.length); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (index >= this._tokens.length) {··· return undefined; } |
| ✓ Negative was executed (else) | }··· if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options && options.includeComments) {··· return this._tokens[index]; } |
| ✓ Negative was executed (else) | }··· do { |
| Branch LogicalExpression | |
| ✓ Was returned | if (options && options.includeComments) { |
| ✓ Was returned | if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!this._tokens[index].isComment) {··· return this._tokens[index]; } |
| ✓ Negative was executed (else) | }··· } while (++index < this._tokens.length); |
| Function (anonymous_100) | |
|---|---|
| ✓ Was called | findPrevToken: function(token, type, value) {··· var prevToken = this.getPrevToken(token); while (prevToken) { if (prevToken.type === type && (value === undefined || prevToken.value === value)) { return prevToken; } prevToken = this.getPrevToken(prevToken); } return prevToken; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.type === type && (value === undefined || prevToken.value === value)) {··· return prevToken; } |
| ✓ Negative was executed (else) | }··· prevToken = this.getPrevToken(prevToken); |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken.type === type && (value === undefined || prevToken.value === value)) { |
| ✓ Was returned | if (prevToken.type === type && (value === undefined || prevToken.value === value)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken.type === type && (value === undefined || prevToken.value === value)) { |
| ✓ Was returned | if (prevToken.type === type && (value === undefined || prevToken.value === value)) { |
| Function (anonymous_101) | |
|---|---|
| ✓ Was called | findNextToken: function(token, type, value) {··· var nextToken = this.getNextToken(token); while (nextToken) { if (nextToken.type === type && (value === undefined || nextToken.value === value)) { return nextToken; } nextToken = this.getNextToken(nextToken); } return nextToken; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === type && (value === undefined || nextToken.value === value)) {··· return nextToken; } |
| ✓ Negative was executed (else) | }··· nextToken = this.getNextToken(nextToken); |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === type && (value === undefined || nextToken.value === value)) { |
| ✓ Was returned | if (nextToken.type === type && (value === undefined || nextToken.value === value)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === type && (value === undefined || nextToken.value === value)) { |
| ✓ Was returned | if (nextToken.type === type && (value === undefined || nextToken.value === value)) { |
| Function (anonymous_102) | |
|---|---|
| ✓ Was called | findPrevOperatorToken: function(token, value) {··· return this.findPrevToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return this.findPrevToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); |
| ✓ Negative was returned (: ...) | return this.findPrevToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); |
| Function (anonymous_103) | |
|---|---|
| ✓ Was called | findNextOperatorToken: function(token, value) {··· return this.findNextToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return this.findNextToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); |
| ✓ Negative was returned (: ...) | return this.findNextToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); |
| Function (anonymous_104) | |
|---|---|
| ✓ Was called | iterate: function(cb, tree) {··· return treeIterator.iterate(tree || this._tree, cb); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return treeIterator.iterate(tree || this._tree, cb); |
| ✓ Was returned | return treeIterator.iterate(tree || this._tree, cb); |
| Function (anonymous_105) | |
|---|---|
| ✓ Was called | getNodeByRange: function(number) {··· var result = {}; this.iterate(function(node) { if (number >= node.range[0] && number < node.range[1]) { result = node; } if (number < node.range[0]) { return false; } }); return result; }, |
| Function (anonymous_106) | |
|---|---|
| ✓ Was called | this.iterate(function(node) {··· if (number >= node.range[0] && number < node.range[1]) { result = node; } if (number < node.range[0]) { return false; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (number >= node.range[0] && number < node.range[1]) {··· result = node; } |
| ✓ Negative was executed (else) | }··· if (number < node.range[0]) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (number >= node.range[0] && number < node.range[1]) { |
| ✓ Was returned | if (number >= node.range[0] && number < node.range[1]) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (number < node.range[0]) {··· return false; } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_107) | |
|---|---|
| ✓ Was called | getNodesByFirstToken: function(token) {··· var result = []; if (token && token.range && token.range[0] >= 0) { var nodes = this._nodesByStartRange[token.range[0]]; if (nodes) { result = result.concat(nodes); } } return result; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token && token.range && token.range[0] >= 0) {··· var nodes = this._nodesByStartRange[token.range[0]]; if (nodes) { result = result.concat(nodes); } } |
| ✓ Negative was executed (else) | }··· return result; |
| Branch LogicalExpression | |
| ✓ Was returned | if (token && token.range && token.range[0] >= 0) { |
| ✓ Was returned | if (token && token.range && token.range[0] >= 0) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (token && token.range && token.range[0] >= 0) { |
| ✓ Was returned | if (token && token.range && token.range[0] >= 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nodes) {··· result = result.concat(nodes); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_108) | |
|---|---|
| ✓ Was called | getNodesByType: function(type) {··· if (typeof type === 'string') { return this._index[type] || []; } else { var result = []; for (var i = 0, l = type.length; i < l; i++) { var nodes = this._index[type[i]]; if (nodes) { result = result.concat(nodes); } } return result; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof type === 'string') {··· return this._index[type] || []; } else { |
| ✓ Negative was executed (else) | } else {··· var result = []; for (var i = 0, l = type.length; i < l; i++) { var nodes = this._index[type[i]]; if (nodes) { result = result.concat(nodes); } } return result; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return this._index[type] || []; |
| ✓ Was returned | return this._index[type] || []; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nodes) {··· result = result.concat(nodes); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_109) | |
|---|---|
| ✓ Was called | iterateNodesByType: function(type, cb) {··· return this.getNodesByType(type).forEach(cb); }, |
| Function (anonymous_110) | |
|---|---|
| ✓ Was called | iterateTokensByType: function(type, cb) {··· var types = (typeof type === 'string') ? [type] : type; var typeIndex = {}; types.forEach(function(type) { typeIndex[type] = true; }); this.getTokens().forEach(function(token, index, tokens) { if (typeIndex[token.type]) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var types = (typeof type === 'string') ? [type] : type; |
| ✓ Negative was returned (: ...) | var types = (typeof type === 'string') ? [type] : type; |
| Function (anonymous_111) | |
|---|---|
| ✓ Was called | types.forEach(function(type) {··· typeIndex[type] = true; }); |
| Function (anonymous_112) | |
|---|---|
| ✓ Was called | this.getTokens().forEach(function(token, index, tokens) {··· if (typeIndex[token.type]) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex[token.type]) {··· cb(token, index, tokens); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_113) | |
|---|---|
| ✓ Was called | iterateTokenByValue: function(name, cb) {··· var names = (typeof name === 'string') ? [name] : name; var nameIndex = {}; names.forEach(function(type) { nameIndex[type] = true; }); this.getTokens().forEach(function(token, index, tokens) { if (nameIndex.hasOwnProperty(token.value)) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var names = (typeof name === 'string') ? [name] : name; |
| ✓ Negative was returned (: ...) | var names = (typeof name === 'string') ? [name] : name; |
| Function (anonymous_114) | |
|---|---|
| ✓ Was called | names.forEach(function(type) {··· nameIndex[type] = true; }); |
| Function (anonymous_115) | |
|---|---|
| ✓ Was called | this.getTokens().forEach(function(token, index, tokens) {··· if (nameIndex.hasOwnProperty(token.value)) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nameIndex.hasOwnProperty(token.value)) {··· cb(token, index, tokens); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_116) | |
|---|---|
| ✓ Was called | iterateTokensByTypeAndValue: function(type, value, cb) {··· var values = (typeof value === 'string') ? [value] : value; var valueIndex = {}; values.forEach(function(type) { valueIndex[type] = true; }); this.getTokens().forEach(function(token, index, tokens) { if (token.type === type && valueIndex[token.value]) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var values = (typeof value === 'string') ? [value] : value; |
| ✓ Negative was returned (: ...) | var values = (typeof value === 'string') ? [value] : value; |
| Function (anonymous_117) | |
|---|---|
| ✓ Was called | values.forEach(function(type) {··· valueIndex[type] = true; }); |
| Function (anonymous_118) | |
|---|---|
| ✓ Was called | this.getTokens().forEach(function(token, index, tokens) {··· if (token.type === type && valueIndex[token.value]) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.type === type && valueIndex[token.value]) {··· cb(token, index, tokens); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (token.type === type && valueIndex[token.value]) { |
| ✓ Was returned | if (token.type === type && valueIndex[token.value]) { |
| Function (anonymous_119) | |
|---|---|
| ✓ Was called | getFirstTokenOnLine: function(lineNumber, options) {··· var tokensByLine = this._tokensByLineIndex[lineNumber]; if (!tokensByLine) { return undefined; } if (options && options.includeComments) { return tokensByLine[0]; } for (var i = 0; i < tokensByLine.length; i++) { var token = tokensByLine[i]; if (!token.isComment) { return token; } } return undefined; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!tokensByLine) {··· return undefined; } |
| ✓ Negative was executed (else) | }··· if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options && options.includeComments) {··· return tokensByLine[0]; } |
| ✓ Negative was executed (else) | }··· for (var i = 0; i < tokensByLine.length; i++) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (options && options.includeComments) { |
| ✓ Was returned | if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!token.isComment) {··· return token; } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_120) | |
|---|---|
| ✓ Was called | getDialect: function() {··· if (this._es6) { return 'es6'; } if (this._es3) { return 'es3'; } return 'es5'; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._es6) {··· return 'es6'; } |
| ✓ Negative was executed (else) | }··· if (this._es3) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._es3) {··· return 'es3'; } |
| ✓ Negative was executed (else) | }··· return 'es5'; |
| Function (anonymous_121) | |
|---|---|
| ✓ Was called | getSource: function() {··· return this._source; }, |
| Function (anonymous_122) | |
|---|---|
| ✓ Was called | getTree: function() {··· return this._tree; }, |
| Function (anonymous_123) | |
|---|---|
| ✓ Was called | getTokens: function() {··· return this._tokens; }, |
| Function (anonymous_124) | |
|---|---|
| ✓ Was called | getComments: function() {··· return this._tree.comments; }, |
| Function (anonymous_125) | |
|---|---|
| ✓ Was called | getFilename: function() {··· return this._filename; }, |
| Function (anonymous_126) | |
|---|---|
| ✓ Was called | getLines: function() {··· return this._lines; }, |
| Function (anonymous_127) | |
|---|---|
| ✓ Was called | getLinesWithCommentsRemoved: function() {··· var lines = this.getLines().concat(); this.getComments().concat().reverse().forEach(function(comment) { var startLine = comment.loc.start.line; var startCol = comment.loc.start.column; var endLine = comment.loc.end.line; var endCol = comment.loc.end.column; var i = startLine - 1; if (startLine === endLine) { lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } }); return lines; }, |
| Function (anonymous_128) | |
|---|---|
| ✓ Was called | this.getComments().concat().reverse().forEach(function(comment) {··· var startLine = comment.loc.start.line; var startCol = comment.loc.start.column; var endLine = comment.loc.end.line; var endCol = comment.loc.end.column; var i = startLine - 1; if (startLine === endLine) { lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (startLine === endLine) {··· lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { |
| ✓ Negative was executed (else) | } else {··· lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } |
| Function (anonymous_129) | |
|---|---|
| ✓ Was called | render: function() {··· var result = ''; // For-loop for maximal speed. for (var i = 0; i < this._tokens.length; i++) { var token = this._tokens[i]; result += token.whitespaceBefore; switch (token.type) { // Line-comment: // ... case 'Line': result += '//' + token.value; break; // Block-comment: /* ... */ case 'Block': result += '/*' + token.value + '*/'; break; default: result += token.value; } } return result; }, |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | case 'Line':··· result += '//' + token.value; break; |
| ✓ Was evaluated | case 'Block':··· result += '/*' + token.value + '*/'; break; |
| ✓ Was evaluated | default:··· result += token.value; |
| Function (anonymous_130) | |
|---|---|
| ✓ Was called | _buildTokenList: function(codeTokens, commentTokens) {··· var result = []; var codeQueue = codeTokens.concat(); var commentQueue = commentTokens.concat(); while (codeQueue.length > 0 || commentQueue.length > 0) { if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { result.push(codeQueue.shift()); } else { var commentToken = commentQueue.shift(); commentToken.isComment = true; result.push(commentToken); } } return result; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | while (codeQueue.length > 0 || commentQueue.length > 0) { |
| ✓ Was returned | while (codeQueue.length > 0 || commentQueue.length > 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) {··· result.push(codeQueue.shift()); } else { |
| ✓ Negative was executed (else) | } else {··· var commentToken = commentQueue.shift(); commentToken.isComment = true; result.push(commentToken); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| ✓ Was returned | if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| ✓ Was returned | if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| Function (anonymous_131) | |
|---|---|
| ✓ Was called | _addEOFToken: function() {··· var loc = { line: this._lines.length, column: this._lines[this._lines.length - 1].length }; this._tokens.push({ type: 'EOF', value: '', range: [this._source.length, this._source.length + 1], loc: {start: loc, end: loc} }); }, |
| Function (anonymous_132) | |
|---|---|
| ✓ Was called | _applyWhitespaceData: function(tokens, source) {··· var prevPos = 0; // For-loop for maximal speed. for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; var rangeStart = token.range[0]; var whitespace; if (rangeStart === prevPos) { whitespace = ''; } else { whitespace = source.substring(prevPos, rangeStart); } token.whitespaceBefore = whitespace; prevPos = token.range[1]; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (rangeStart === prevPos) {··· whitespace = ''; } else { |
| ✓ Negative was executed (else) | } else {··· whitespace = source.substring(prevPos, rangeStart); } |
| Function (anonymous_133) | |
|---|---|
| ✓ Was called | _fixEs6Tokens: function(tokens) {··· if (this.getDialect() !== 'es6') { return tokens; } var tokenHash = {}; return tokens.filter(function(token) { var hashKey = token.range[0] + '_' + token.range[1]; var isDuplicate = tokenHash[hashKey]; tokenHash[hashKey] = true; return !isDuplicate; }); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this.getDialect() !== 'es6') {··· return tokens; } |
| ✓ Negative was executed (else) | }··· var tokenHash = {}; |
| Function (anonymous_134) | |
|---|---|
| ✓ Was called | return tokens.filter(function(token) {··· var hashKey = token.range[0] + '_' + token.range[1]; var isDuplicate = tokenHash[hashKey]; tokenHash[hashKey] = true; return !isDuplicate; }); |
| Function (anonymous_135) | |
|---|---|
| ✓ Was called | _buildNodeIndex: function() {··· var nodesByType = {}; var nodesByStartRange = {}; this.iterate(function(node, parentNode, parentCollection) { var type = node.type; node.parentNode = parentNode; node.parentCollection = parentCollection; (nodesByType[type] || (nodesByType[type] = [])).push(node); // this part builds a node index that uses node start ranges as the key var startRange = node.range[0]; (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); }); return { nodesByType: nodesByType, nodesByStartRange: nodesByStartRange }; }, |
| Function (anonymous_136) | |
|---|---|
| ✓ Was called | this.iterate(function(node, parentNode, parentCollection) {··· var type = node.type; node.parentNode = parentNode; node.parentCollection = parentCollection; (nodesByType[type] || (nodesByType[type] = [])).push(node); // this part builds a node index that uses node start ranges as the key var startRange = node.range[0]; (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (nodesByType[type] || (nodesByType[type] = [])).push(node); |
| ✓ Was returned | (nodesByType[type] || (nodesByType[type] = [])).push(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); |
| ✓ Was returned | (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); |
| Function (anonymous_137) | |
|---|---|
| ✓ Was called | _fixEsprimaIdentifiers: function() {··· var _this = this; this.iterateNodesByType(['Property', 'MemberExpression'], function(node) { switch (node.type) { case 'Property': convertKeywordToIdentifierIfRequired(node.key); break; case 'MemberExpression': convertKeywordToIdentifierIfRequired(node.property); break; } }); function convertKeywordToIdentifierIfRequired(node) { var token = _this.getTokenByRangeStart(node.range[0]); if (token.type === 'Keyword') { token.type = 'Identifier'; } } } |
| Function (anonymous_138) | |
|---|---|
| ✓ Was called | this.iterateNodesByType(['Property', 'MemberExpression'], function(node) {··· switch (node.type) { case 'Property': convertKeywordToIdentifierIfRequired(node.key); break; case 'MemberExpression': convertKeywordToIdentifierIfRequired(node.property); break; } }); |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | case 'Property':··· convertKeywordToIdentifierIfRequired(node.key); break; |
| ✓ Was evaluated | case 'MemberExpression':··· convertKeywordToIdentifierIfRequired(node.property); break; |
| Function convertKeywordToIdentifierIfRequired | |
|---|---|
| ✓ Was called | function convertKeywordToIdentifierIfRequired(node) {··· var token = _this.getTokenByRangeStart(node.range[0]); if (token.type === 'Keyword') { token.type = 'Identifier'; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.type === 'Keyword') {··· token.type = 'Identifier'; } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_140) | |
|---|---|
| ✓ Was called | JsFile.parse = function(source, esprima, esprimaOptions) {··· var finalEsprimaOptions = { tolerant: true }; if (esprimaOptions) { for (var key in esprimaOptions) { finalEsprimaOptions[key] = esprimaOptions[key]; } } // Set required options finalEsprimaOptions.loc = true; finalEsprimaOptions.range = true; finalEsprimaOptions.comment = true; finalEsprimaOptions.tokens = true; finalEsprimaOptions.sourceType = 'module'; var hashbang = source.indexOf('#!') === 0; var tree; // Convert bin annotation to a comment if (hashbang) { source = '//' + source.substr(2); } var instrumentationData = {}; var hasInstrumentationData = false; // Process special case code like iOS instrumentation imports: `#import 'abc.js';` source = source.replace(/^#!?[^\n]+\n/gm, function(str, pos) { hasInstrumentationData = true; instrumentationData[pos] = str.substring(0, str.length - 1); return '//' + str.slice(2); }); tree = esprima.parse(source, finalEsprimaOptions); // Change the bin annotation comment if (hashbang) { tree.comments[0].type = 'Hashbang'; tree.comments[0].value = '#!' + tree.comments[0].value; } if (hasInstrumentationData) { tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); } return tree; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (esprimaOptions) {··· for (var key in esprimaOptions) { finalEsprimaOptions[key] = esprimaOptions[key]; } } |
| ✓ Negative was executed (else) | }··· // Set required options |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hashbang) {··· source = '//' + source.substr(2); } |
| ✓ Negative was executed (else) | }··· var instrumentationData = {}; |
| Function (anonymous_141) | |
|---|---|
| ✓ Was called | source = source.replace(/^#!?[^\n]+\n/gm, function(str, pos) {··· hasInstrumentationData = true; instrumentationData[pos] = str.substring(0, str.length - 1); return '//' + str.slice(2); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hashbang) {··· tree.comments[0].type = 'Hashbang'; tree.comments[0].value = '#!' + tree.comments[0].value; } |
| ✓ Negative was executed (else) | }··· if (hasInstrumentationData) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hasInstrumentationData) {··· tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); } |
| ✓ Negative was executed (else) | }··· return tree; |
| Function (anonymous_142) | |
|---|---|
| ✓ Was called | tree.comments.forEach(function(token) {··· var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (instrumentationData.hasOwnProperty(rangeStart)) {··· token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } |
| ✓ Negative was executed (else) | }··· }); |
| Function iterate | |
|---|---|
| ✓ Was called | function iterate(node, cb) {··· if ('type' in node) { estraverse.traverse(node, { enter: function(node, parent) { var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, keys: { JSXIdentifier: [], JSXNamespacedName: ['namespace', 'name'], JSXMemberExpression: ['object', 'property'], JSXEmptyExpression: [], JSXExpressionContainer: ['expression'], JSXElement: ['openingElement', 'closingElement', 'children'], JSXClosingElement: ['name'], JSXOpeningElement: ['name', 'attributes'], JSXAttribute: ['name', 'value'], JSXSpreadAttribute: ['argument'], JSXText: null, XJSIdentifier: [], XJSNamespacedName: ['namespace', 'name'], XJSMemberExpression: ['object', 'property'], XJSEmptyExpression: [], XJSExpressionContainer: ['expression'], XJSElement: ['openingElement', 'closingElement', 'children'], XJSClosingElement: ['name'], XJSOpeningElement: ['name', 'attributes'], XJSAttribute: ['name', 'value'], XJSSpreadAttribute: ['argument'], XJSText: null } }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('type' in node) {··· estraverse.traverse(node, { enter: function(node, parent) { var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, keys: { JSXIdentifier: [], JSXNamespacedName: ['namespace', 'name'], JSXMemberExpression: ['object', 'property'], JSXEmptyExpression: [], JSXExpressionContainer: ['expression'], JSXElement: ['openingElement', 'closingElement', 'children'], JSXClosingElement: ['name'], JSXOpeningElement: ['name', 'attributes'], JSXAttribute: ['name', 'value'], JSXSpreadAttribute: ['argument'], JSXText: null, XJSIdentifier: [], XJSNamespacedName: ['namespace', 'name'], XJSMemberExpression: ['object', 'property'], XJSEmptyExpression: [], XJSExpressionContainer: ['expression'], XJSElement: ['openingElement', 'closingElement', 'children'], XJSClosingElement: ['name'], XJSOpeningElement: ['name', 'attributes'], XJSAttribute: ['name', 'value'], XJSSpreadAttribute: ['argument'], XJSText: null } }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_144) | |
|---|---|
| ✓ Was called | enter: function(node, parent) {··· var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (path) {··· var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } |
| ✓ Negative was executed (else) | }··· if (cb(node, parent, parentCollection) === false) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof pathElement === 'string') {··· collectionKey = pathElement; break; } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!Array.isArray(parentCollection)) {··· parentCollection = [parentCollection]; } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (cb(node, parent, parentCollection) === false) {··· return estraverse.VisitorOption.Skip; } |
| ✓ Negative was executed (else) | }··· }, |
| Function Configuration | |
|---|---|
| ✓ Was called | function Configuration() {··· this._presets = {}; this._rules = {}; this._configuredRules = []; this._unsupportedRuleNames = []; this._fileExtensions = ['.js']; this._excludedFileMasks = []; this._excludedFileMatchers = []; this._ruleSettings = {}; this._maxErrors = null; this._basePath = '.'; this._overrides = {}; this._presetName = null; this._esnextEnabled = false; this._es3Enabled = true; this._esprima = null; this._esprimaOptions = {}; this._errorFilter = null; this._verbose = null; } |
| Function (anonymous_146) | |
|---|---|
| ✓ Was called | Configuration.prototype.load = function(config) {··· this._throwNonCamelCaseErrorIfNeeded(config); var overrides = this._overrides; var currentConfig = {}; copyConfiguration(config, currentConfig); copyConfiguration(overrides, currentConfig); var ruleSettings = this._processConfig(currentConfig); var processedSettings = {}; Object.keys(ruleSettings).forEach(function(optionName) { var rule = this._rules[optionName]; if (rule) { var optionValue = ruleSettings[optionName]; if (optionValue !== null) { rule.configure(ruleSettings[optionName]); this._configuredRules.push(rule); processedSettings[optionName] = ruleSettings[optionName]; } } else { this._unsupportedRuleNames.push(optionName); } }, this); this._ruleSettings = processedSettings; }; |
| Function (anonymous_147) | |
|---|---|
| ✓ Was called | Object.keys(ruleSettings).forEach(function(optionName) {··· var rule = this._rules[optionName]; if (rule) { var optionValue = ruleSettings[optionName]; if (optionValue !== null) { rule.configure(ruleSettings[optionName]); this._configuredRules.push(rule); processedSettings[optionName] = ruleSettings[optionName]; } } else { this._unsupportedRuleNames.push(optionName); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (rule) {··· var optionValue = ruleSettings[optionName]; if (optionValue !== null) { rule.configure(ruleSettings[optionName]); this._configuredRules.push(rule); processedSettings[optionName] = ruleSettings[optionName]; } } else { |
| ✓ Negative was executed (else) | } else {··· this._unsupportedRuleNames.push(optionName); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (optionValue !== null) {··· rule.configure(ruleSettings[optionName]); this._configuredRules.push(rule); processedSettings[optionName] = ruleSettings[optionName]; } |
| ✓ Negative was executed (else) | }··· } else { |
| Function (anonymous_148) | |
|---|---|
| ✓ Was called | Configuration.prototype.getProcessedConfig = function() {··· var result = {}; Object.keys(this._ruleSettings).forEach(function(key) { result[key] = this._ruleSettings[key]; }, this); result.excludeFiles = this._excludedFileMasks; result.fileExtensions = this._fileExtensions; result.maxErrors = this._maxErrors; result.preset = this._presetName; result.esnext = this._esnextEnabled; result.es3 = this._es3Enabled; result.esprima = this._esprima; result.esprimaOptions = this._esprimaOptions; result.errorFilter = this._errorFilter; return result; }; |
| Function (anonymous_149) | |
|---|---|
| ✓ Was called | Object.keys(this._ruleSettings).forEach(function(key) {··· result[key] = this._ruleSettings[key]; }, this); |
| Function (anonymous_150) | |
|---|---|
| ✓ Was called | Configuration.prototype.getConfiguredRules = function() {··· return this._configuredRules; }; |
| Function (anonymous_151) | |
|---|---|
| ✓ Was called | Configuration.prototype.getUnsupportedRuleNames = function() {··· return this._unsupportedRuleNames; }; |
| Function (anonymous_152) | |
|---|---|
| ✓ Was called | Configuration.prototype.getExcludedFileMasks = function() {··· return this._excludedFileMasks; }; |
| Function (anonymous_153) | |
|---|---|
| ✓ Was called | Configuration.prototype.isFileExcluded = function(filePath) {··· filePath = path.resolve(filePath); return this._excludedFileMatchers.some(function(matcher) { return matcher.match(filePath); }); }; |
| Function (anonymous_154) | |
|---|---|
| ✓ Was called | return this._excludedFileMatchers.some(function(matcher) {··· return matcher.match(filePath); }); |
| Function (anonymous_155) | |
|---|---|
| ✓ Was called | Configuration.prototype.getFileExtensions = function() {··· return this._fileExtensions; }; |
| Function (anonymous_156) | |
|---|---|
| ✓ Was called | Configuration.prototype.getMaxErrors = function() {··· return this._maxErrors; }; |
| Function (anonymous_157) | |
|---|---|
| ✓ Was called | Configuration.prototype.isESNextEnabled = function() {··· return this._esnextEnabled; }; |
| Function (anonymous_158) | |
|---|---|
| ✓ Was called | Configuration.prototype.isES3Enabled = function() {··· return this._es3Enabled; }; |
| Function (anonymous_160) | |
|---|---|
| ✗ Was not called | Configuration.prototype.getCustomEsprima = function() {··· return this._esprima; }; |
| Function (anonymous_161) | |
|---|---|
| ✓ Was called | Configuration.prototype.getVerbose = function() {··· return this._verbose || false; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return this._verbose || false; |
| ✓ Was returned | return this._verbose || false; |
| Function (anonymous_162) | |
|---|---|
| ✓ Was called | Configuration.prototype.getEsprimaOptions = function() {··· return this._esprimaOptions; }; |
| Function (anonymous_163) | |
|---|---|
| ✓ Was called | Configuration.prototype.getErrorFilter = function() {··· return this._errorFilter; }; |
| Function (anonymous_164) | |
|---|---|
| ✓ Was called | Configuration.prototype.getBasePath = function() {··· return this._basePath; }; |
| Function (anonymous_165) | |
|---|---|
| ✓ Was called | Configuration.prototype.override = function(overrides) {··· Object.keys(overrides).forEach(function(key) { this._overrides[key] = overrides[key]; }, this); }; |
| Function (anonymous_166) | |
|---|---|
| ✓ Was called | Object.keys(overrides).forEach(function(key) {··· this._overrides[key] = overrides[key]; }, this); |
| Function (anonymous_167) | |
|---|---|
| ✓ Was called | Configuration.prototype._getOptionsFromConfig = function(config) {··· return Object.keys(config).reduce(function(options, key) { if (BUILTIN_OPTIONS[key]) { options[key] = config[key]; } return options; }, {}); }; |
| Function (anonymous_168) | |
|---|---|
| ✓ Was called | return Object.keys(config).reduce(function(options, key) {··· if (BUILTIN_OPTIONS[key]) { options[key] = config[key]; } return options; }, {}); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (BUILTIN_OPTIONS[key]) {··· options[key] = config[key]; } |
| ✓ Negative was executed (else) | }··· return options; |
| Function (anonymous_169) | |
|---|---|
| ✓ Was called | Configuration.prototype._processConfig = function(config) {··· var ruleSettings = {}; // NOTE: options is a separate object to ensure that future options must be added // to BUILTIN_OPTIONS to work, which also assures they aren't mistaken for a rule var options = this._getOptionsFromConfig(config); // Base path if (options.configPath) { assert( typeof options.configPath === 'string', '`configPath` option requires string value' ); this._basePath = path.dirname(options.configPath); } // Load plugins if (options.plugins) { assert(Array.isArray(options.plugins), '`plugins` option requires array value'); options.plugins.forEach(this._loadPlugin, this); } // Apply presets var presetName = options.preset; if (presetName) { this._presetName = presetName; assert(typeof presetName === 'string', '`preset` option requires string value'); var presetData = this._presets[presetName]; assert(Boolean(presetData), 'Preset "' + presetName + '" does not exist'); var presetResult = this._processConfig(presetData); Object.keys(presetResult).forEach(function(key) { ruleSettings[key] = presetResult[key]; }); } // File extensions if (options.fileExtensions) { assert( typeof options.fileExtensions === 'string' || Array.isArray(options.fileExtensions), '`fileExtensions` option requires string or array value' ); this._fileExtensions = [].concat(options.fileExtensions).map(function(ext) { return ext.toLowerCase(); }); } // File excludes if (options.excludeFiles) { assert(Array.isArray(options.excludeFiles), '`excludeFiles` option requires array value'); this._excludedFileMasks = options.excludeFiles; this._excludedFileMatchers = this._excludedFileMasks.map(function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); } // Additional rules if (options.additionalRules) { assert(Array.isArray(options.additionalRules), '`additionalRules` option requires array value'); options.additionalRules.forEach(this._loadAdditionalRule, this); } if (options.hasOwnProperty('maxErrors')) { var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); assert( maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, '`maxErrors` option requires number or null value' ); this._maxErrors = maxErrors; } if (options.hasOwnProperty('esnext')) { assert( typeof options.esnext === 'boolean' || options.esnext === null, '`esnext` option requires boolean or null value' ); this._esnextEnabled = Boolean(options.esnext); } if (options.hasOwnProperty('es3')) { assert( typeof options.es3 === 'boolean' || options.es3 === null, '`es3` option requires boolean or null value' ); this._es3Enabled = Boolean(options.es3); } if (options.hasOwnProperty('esprima')) { this._loadEsprima(options.esprima); } if (options.hasOwnProperty('esprimaOptions')) { this._loadEsprimaOptions(options.esprimaOptions); } if (options.hasOwnProperty('errorFilter')) { this._loadErrorFilter(options.errorFilter); } if (options.hasOwnProperty('verbose')) { this._loadVerbose(options.verbose); } // NOTE: rule setting must come last in order to // override any rules that are loaded from a preset Object.keys(config).forEach(function(key) { if (!BUILTIN_OPTIONS[key]) { ruleSettings[key] = config[key]; } }); return ruleSettings; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.configPath) {··· assert( typeof options.configPath === 'string', '`configPath` option requires string value' ); this._basePath = path.dirname(options.configPath); } |
| ✓ Negative was executed (else) | }··· // Load plugins |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.plugins) {··· assert(Array.isArray(options.plugins), '`plugins` option requires array value'); options.plugins.forEach(this._loadPlugin, this); } |
| ✓ Negative was executed (else) | }··· // Apply presets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (presetName) {··· this._presetName = presetName; assert(typeof presetName === 'string', '`preset` option requires string value'); var presetData = this._presets[presetName]; assert(Boolean(presetData), 'Preset "' + presetName + '" does not exist'); var presetResult = this._processConfig(presetData); Object.keys(presetResult).forEach(function(key) { ruleSettings[key] = presetResult[key]; }); } |
| ✓ Negative was executed (else) | }··· // File extensions |
| Function (anonymous_170) | |
|---|---|
| ✓ Was called | Object.keys(presetResult).forEach(function(key) {··· ruleSettings[key] = presetResult[key]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.fileExtensions) {··· assert( typeof options.fileExtensions === 'string' || Array.isArray(options.fileExtensions), '`fileExtensions` option requires string or array value' ); this._fileExtensions = [].concat(options.fileExtensions).map(function(ext) { return ext.toLowerCase(); }); } |
| ✓ Negative was executed (else) | }··· // File excludes |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options.fileExtensions === 'string' || Array.isArray(options.fileExtensions), |
| ✓ Was returned | typeof options.fileExtensions === 'string' || Array.isArray(options.fileExtensions), |
| Function (anonymous_171) | |
|---|---|
| ✓ Was called | this._fileExtensions = [].concat(options.fileExtensions).map(function(ext) {··· return ext.toLowerCase(); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.excludeFiles) {··· assert(Array.isArray(options.excludeFiles), '`excludeFiles` option requires array value'); this._excludedFileMasks = options.excludeFiles; this._excludedFileMatchers = this._excludedFileMasks.map(function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); } |
| ✓ Negative was executed (else) | }··· // Additional rules |
| Function (anonymous_172) | |
|---|---|
| ✓ Was called | this._excludedFileMatchers = this._excludedFileMasks.map(function(fileMask) {··· return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.additionalRules) {··· assert(Array.isArray(options.additionalRules), '`additionalRules` option requires array value'); options.additionalRules.forEach(this._loadAdditionalRule, this); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('maxErrors')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('maxErrors')) {··· var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); assert( maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, '`maxErrors` option requires number or null value' ); this._maxErrors = maxErrors; } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('esnext')) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); |
| ✓ Negative was returned (: ...) | var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, |
| ✓ Was returned | maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, |
| Branch LogicalExpression | |
| ✓ Was returned | maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, |
| ✓ Was returned | maxErrors > 0 || isNaN(maxErrors) || maxErrors === null, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('esnext')) {··· assert( typeof options.esnext === 'boolean' || options.esnext === null, '`esnext` option requires boolean or null value' ); this._esnextEnabled = Boolean(options.esnext); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('es3')) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options.esnext === 'boolean' || options.esnext === null, |
| ✓ Was returned | typeof options.esnext === 'boolean' || options.esnext === null, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('es3')) {··· assert( typeof options.es3 === 'boolean' || options.es3 === null, '`es3` option requires boolean or null value' ); this._es3Enabled = Boolean(options.es3); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('esprima')) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options.es3 === 'boolean' || options.es3 === null, |
| ✓ Was returned | typeof options.es3 === 'boolean' || options.es3 === null, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (options.hasOwnProperty('esprima')) {··· this._loadEsprima(options.esprima); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('esprimaOptions')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('esprimaOptions')) {··· this._loadEsprimaOptions(options.esprimaOptions); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('errorFilter')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('errorFilter')) {··· this._loadErrorFilter(options.errorFilter); } |
| ✓ Negative was executed (else) | }··· if (options.hasOwnProperty('verbose')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.hasOwnProperty('verbose')) {··· this._loadVerbose(options.verbose); } |
| ✓ Negative was executed (else) | }··· // NOTE: rule setting must come last in order to |
| Function (anonymous_173) | |
|---|---|
| ✓ Was called | Object.keys(config).forEach(function(key) {··· if (!BUILTIN_OPTIONS[key]) { ruleSettings[key] = config[key]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!BUILTIN_OPTIONS[key]) {··· ruleSettings[key] = config[key]; } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_174) | |
|---|---|
| ✓ Was called | Configuration.prototype._loadPlugin = function(plugin) {··· assert(typeof plugin === 'function', '`plugin` should be a function'); plugin(this); }; |
| Function (anonymous_175) | |
|---|---|
| ✓ Was called | Configuration.prototype._loadErrorFilter = function(errorFilter) {··· assert( typeof errorFilter === 'function' || errorFilter === null, '`errorFilter` option requires a function or null value' ); this._errorFilter = errorFilter; }; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | errorFilter === null, |
| ✓ Was returned | typeof errorFilter === 'function' || |
| Function (anonymous_176) | |
|---|---|
| ✓ Was called | Configuration.prototype._loadVerbose = function(verbose) {··· assert( typeof verbose === 'boolean' || verbose === null, '`verbose` option requires a boolean or null value' ); this._verbose = verbose; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof verbose === 'boolean' || verbose === null, |
| ✓ Was returned | typeof verbose === 'boolean' || verbose === null, |
| Function (anonymous_177) | |
|---|---|
| ✗ Was not called | Configuration.prototype._loadEsprima = function(esprima) {··· assert( (esprima && typeof esprima.parse === 'function') || esprima === null, '`esprima` option requires a null value or an object with a parse function' ); this._esprima = esprima; }; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | esprima === null, |
| ✗ Was not returned | (esprima && typeof esprima.parse === 'function') || |
| Branch LogicalExpression | |
| ✗ Was not returned | (esprima && typeof esprima.parse === 'function') || |
| ✗ Was not returned | (esprima && typeof esprima.parse === 'function') || |
| Function (anonymous_178) | |
|---|---|
| ✓ Was called | Configuration.prototype._loadEsprimaOptions = function(esprimaOptions) {··· assert(typeof esprimaOptions === 'object' && esprimaOptions !== null, '`esprimaOptions` should be an object'); this._esprimaOptions = esprimaOptions; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(typeof esprimaOptions === 'object' && esprimaOptions !== null, '`esprimaOptions` should be an object'); |
| ✓ Was returned | assert(typeof esprimaOptions === 'object' && esprimaOptions !== null, '`esprimaOptions` should be an object'); |
| Function (anonymous_179) | |
|---|---|
| ✓ Was called | Configuration.prototype.usePlugin = function(plugin) {··· this._loadPlugin(plugin); }; |
| Function (anonymous_180) | |
|---|---|
| ✓ Was called | Configuration.prototype._loadAdditionalRule = function(additionalRule) {··· assert(typeof additionalRule === 'object', '`additionalRule` should be an object'); this.registerRule(additionalRule); }; |
| Function (anonymous_181) | |
|---|---|
| ✓ Was called | Configuration.prototype._throwNonCamelCaseErrorIfNeeded = function(ruleSettings) {··· function symbolToUpperCase(s, symbol) { return symbol.toUpperCase(); } function fixSettings(originalSettings) { var result = {}; Object.keys(originalSettings).forEach(function(key) { var camelCaseName = key.replace(/_([a-zA-Z])/g, symbolToUpperCase); var value = originalSettings[key]; if (typeof value === 'object' && value !== null && !Array.isArray(value)) { value = fixSettings(value); } result[camelCaseName] = value; }); return result; } Object.keys(ruleSettings).forEach(function(key) { if (key.indexOf('_') !== -1) { throw new Error( 'JSCS now accepts configuration options in camel case. Sorry for inconvenience. ' + 'On the bright side, we tried to convert your jscs config to camel case.\n' + '----------------------------------------\n' + JSON.stringify(fixSettings(ruleSettings), null, 4) + '\n----------------------------------------\n' ); } }); }; |
| Function symbolToUpperCase | |
|---|---|
| ✓ Was called | function symbolToUpperCase(s, symbol) {··· return symbol.toUpperCase(); } |
| Function fixSettings | |
|---|---|
| ✓ Was called | function fixSettings(originalSettings) {··· var result = {}; Object.keys(originalSettings).forEach(function(key) { var camelCaseName = key.replace(/_([a-zA-Z])/g, symbolToUpperCase); var value = originalSettings[key]; if (typeof value === 'object' && value !== null && !Array.isArray(value)) { value = fixSettings(value); } result[camelCaseName] = value; }); return result; } |
| Function (anonymous_184) | |
|---|---|
| ✓ Was called | Object.keys(originalSettings).forEach(function(key) {··· var camelCaseName = key.replace(/_([a-zA-Z])/g, symbolToUpperCase); var value = originalSettings[key]; if (typeof value === 'object' && value !== null && !Array.isArray(value)) { value = fixSettings(value); } result[camelCaseName] = value; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'object' && value !== null && !Array.isArray(value)) {··· value = fixSettings(value); } |
| ✓ Negative was executed (else) | }··· result[camelCaseName] = value; |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeof value === 'object' && value !== null && !Array.isArray(value)) { |
| ✓ Was returned | if (typeof value === 'object' && value !== null && !Array.isArray(value)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeof value === 'object' && value !== null && !Array.isArray(value)) { |
| ✓ Was returned | if (typeof value === 'object' && value !== null && !Array.isArray(value)) { |
| Function (anonymous_185) | |
|---|---|
| ✓ Was called | Object.keys(ruleSettings).forEach(function(key) {··· if (key.indexOf('_') !== -1) { throw new Error( 'JSCS now accepts configuration options in camel case. Sorry for inconvenience. ' + 'On the bright side, we tried to convert your jscs config to camel case.\n' + '----------------------------------------\n' + JSON.stringify(fixSettings(ruleSettings), null, 4) + '\n----------------------------------------\n' ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (key.indexOf('_') !== -1) {··· throw new Error( 'JSCS now accepts configuration options in camel case. Sorry for inconvenience. ' + 'On the bright side, we tried to convert your jscs config to camel case.\n' + '----------------------------------------\n' + JSON.stringify(fixSettings(ruleSettings), null, 4) + '\n----------------------------------------\n' ); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_186) | |
|---|---|
| ✓ Was called | Configuration.prototype.registerRule = function(rule) {··· if (typeof rule === 'function') { var RuleClass = rule; rule = new RuleClass(); } var optionName = rule.getOptionName(); assert(!this._rules.hasOwnProperty(optionName), 'Rule "' + optionName + '" is already registered'); this._rules[optionName] = rule; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof rule === 'function') {··· var RuleClass = rule; rule = new RuleClass(); } |
| ✓ Negative was executed (else) | }··· var optionName = rule.getOptionName(); |
| Function (anonymous_187) | |
|---|---|
| ✓ Was called | Configuration.prototype.getRegisteredRules = function() {··· var rules = this._rules; return Object.keys(rules).map(function(ruleOptionName) { return rules[ruleOptionName]; }); }; |
| Function (anonymous_188) | |
|---|---|
| ✓ Was called | return Object.keys(rules).map(function(ruleOptionName) {··· return rules[ruleOptionName]; }); |
| Function (anonymous_189) | |
|---|---|
| ✓ Was called | Configuration.prototype.registerPreset = function(presetName, presetConfig) {··· this._presets[presetName] = presetConfig; }; |
| Function (anonymous_190) | |
|---|---|
| ✓ Was called | Configuration.prototype.getRegisteredPresets = function() {··· return this._presets; }; |
| Function (anonymous_191) | |
|---|---|
| ✓ Was called | Configuration.prototype.hasPreset = function(presetName) {··· return this._presets.hasOwnProperty(presetName); }; |
| Function (anonymous_192) | |
|---|---|
| ✓ Was called | Configuration.prototype.registerDefaultRules = function() {··· /* Important! These rules are linked explicitly to keep browser-version supported. */ this.registerRule(require('../rules/require-curly-braces')); this.registerRule(require('../rules/disallow-curly-braces')); this.registerRule(require('../rules/require-multiple-var-decl')); this.registerRule(require('../rules/disallow-multiple-var-decl')); this.registerRule(require('../rules/disallow-empty-blocks')); this.registerRule(require('../rules/require-space-after-keywords')); this.registerRule(require('../rules/require-space-before-keywords')); this.registerRule(require('../rules/disallow-space-after-keywords')); this.registerRule(require('../rules/disallow-space-before-keywords')); this.registerRule(require('../rules/require-parentheses-around-iife')); /* deprecated rules */ this.registerRule(require('../rules/require-left-sticked-operators')); this.registerRule(require('../rules/disallow-left-sticked-operators')); this.registerRule(require('../rules/require-right-sticked-operators')); this.registerRule(require('../rules/disallow-right-sticked-operators')); this.registerRule(require('../rules/validate-jsdoc')); /* deprecated rules (end) */ this.registerRule(require('../rules/require-operator-before-line-break')); this.registerRule(require('../rules/disallow-operator-before-line-break')); this.registerRule(require('../rules/disallow-implicit-type-conversion')); this.registerRule(require('../rules/require-camelcase-or-uppercase-identifiers')); this.registerRule(require('../rules/disallow-keywords')); this.registerRule(require('../rules/disallow-multiple-line-breaks')); this.registerRule(require('../rules/disallow-multiple-line-strings')); this.registerRule(require('../rules/disallow-multiple-spaces')); this.registerRule(require('../rules/validate-line-breaks')); this.registerRule(require('../rules/validate-quote-marks')); this.registerRule(require('../rules/validate-indentation')); this.registerRule(require('../rules/disallow-trailing-whitespace')); this.registerRule(require('../rules/disallow-mixed-spaces-and-tabs')); this.registerRule(require('../rules/require-keywords-on-new-line')); this.registerRule(require('../rules/disallow-keywords-on-new-line')); this.registerRule(require('../rules/require-line-feed-at-file-end')); this.registerRule(require('../rules/maximum-line-length')); this.registerRule(require('../rules/require-yoda-conditions')); this.registerRule(require('../rules/disallow-yoda-conditions')); this.registerRule(require('../rules/require-spaces-inside-brackets')); this.registerRule(require('../rules/require-spaces-inside-object-brackets')); this.registerRule(require('../rules/require-spaces-inside-array-brackets')); this.registerRule(require('../rules/require-spaces-inside-parentheses')); this.registerRule(require('../rules/disallow-spaces-inside-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-object-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-array-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-parentheses')); this.registerRule(require('../rules/require-blocks-on-newline')); this.registerRule(require('../rules/require-space-after-object-keys')); this.registerRule(require('../rules/require-space-before-object-values')); this.registerRule(require('../rules/disallow-space-after-object-keys')); this.registerRule(require('../rules/disallow-space-before-object-values')); this.registerRule(require('../rules/disallow-quoted-keys-in-objects')); this.registerRule(require('../rules/require-quoted-keys-in-objects')); this.registerRule(require('../rules/disallow-dangling-underscores')); this.registerRule(require('../rules/require-aligned-object-values')); this.registerRule(require('../rules/validate-aligned-function-parameters')); this.registerRule(require('../rules/disallow-padding-newlines-after-blocks')); this.registerRule(require('../rules/require-padding-newlines-after-blocks')); this.registerRule(require('../rules/disallow-padding-newlines-in-blocks')); this.registerRule(require('../rules/require-padding-newlines-in-blocks')); this.registerRule(require('../rules/require-padding-newlines-in-objects')); this.registerRule(require('../rules/disallow-padding-newlines-in-objects')); this.registerRule(require('../rules/require-newline-before-block-statements')); this.registerRule(require('../rules/disallow-newline-before-block-statements')); this.registerRule(require('../rules/require-padding-newlines-before-keywords')); this.registerRule(require('../rules/disallow-padding-newlines-before-keywords')); this.registerRule(require('../rules/disallow-padding-newlines-before-line-comments')); this.registerRule(require('../rules/require-padding-newlines-before-line-comments')); this.registerRule(require('../rules/disallow-trailing-comma')); this.registerRule(require('../rules/require-trailing-comma')); this.registerRule(require('../rules/require-dollar-before-jquery-assignment')); this.registerRule(require('../rules/disallow-comma-before-line-break')); this.registerRule(require('../rules/require-comma-before-line-break')); this.registerRule(require('../rules/disallow-space-before-block-statements.js')); this.registerRule(require('../rules/require-space-before-block-statements.js')); this.registerRule(require('../rules/disallow-space-before-postfix-unary-operators.js')); this.registerRule(require('../rules/require-space-before-postfix-unary-operators.js')); this.registerRule(require('../rules/disallow-space-after-prefix-unary-operators.js')); this.registerRule(require('../rules/require-space-after-prefix-unary-operators.js')); this.registerRule(require('../rules/disallow-space-before-binary-operators')); this.registerRule(require('../rules/require-space-before-binary-operators')); this.registerRule(require('../rules/disallow-space-after-binary-operators')); this.registerRule(require('../rules/require-space-after-binary-operators')); this.registerRule(require('../rules/require-spaces-in-conditional-expression')); this.registerRule(require('../rules/disallow-spaces-in-conditional-expression')); this.registerRule(require('../rules/require-spaces-in-function')); this.registerRule(require('../rules/disallow-spaces-in-function')); this.registerRule(require('../rules/require-spaces-in-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-function-expression')); this.registerRule(require('../rules/require-spaces-in-anonymous-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-anonymous-function-expression')); this.registerRule(require('../rules/require-spaces-in-named-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-named-function-expression')); this.registerRule(require('../rules/require-spaces-in-function-declaration')); this.registerRule(require('../rules/disallow-spaces-in-function-declaration')); this.registerRule(require('../rules/require-spaces-in-call-expression')); this.registerRule(require('../rules/disallow-spaces-in-call-expression')); this.registerRule(require('../rules/validate-parameter-separator')); this.registerRule(require('../rules/require-space-between-arguments')); this.registerRule(require('../rules/disallow-space-between-arguments')); this.registerRule(require('../rules/require-capitalized-constructors')); this.registerRule(require('../rules/safe-context-keyword')); this.registerRule(require('../rules/require-dot-notation')); this.registerRule(require('../rules/require-space-after-line-comment')); this.registerRule(require('../rules/disallow-space-after-line-comment')); this.registerRule(require('../rules/require-anonymous-functions')); this.registerRule(require('../rules/disallow-anonymous-functions')); this.registerRule(require('../rules/require-named-unassigned-functions')); this.registerRule(require('../rules/disallow-named-unassigned-functions')); this.registerRule(require('../rules/require-function-declarations')); this.registerRule(require('../rules/disallow-function-declarations')); this.registerRule(require('../rules/require-capitalized-comments')); this.registerRule(require('../rules/disallow-capitalized-comments')); this.registerRule(require('../rules/require-line-break-after-variable-assignment')); this.registerRule(require('../rules/require-padding-newline-after-variable-declaration')); this.registerRule(require('../rules/disallow-padding-newlines-after-use-strict')); this.registerRule(require('../rules/require-padding-newlines-after-use-strict')); this.registerRule(require('../rules/disallow-padding-newlines-before-export')); this.registerRule(require('../rules/require-padding-newlines-before-export')); this.registerRule(require('../rules/require-semicolons')); this.registerRule(require('../rules/disallow-semicolons')); this.registerRule(require('../rules/require-spaces-in-for-statement')); this.registerRule(require('../rules/disallow-spaces-in-for-statement')); this.registerRule(require('../rules/disallow-keywords-in-comments')); this.registerRule(require('../rules/disallow-identifier-names')); this.registerRule(require('../rules/maximum-number-of-lines')); this.registerRule(require('../rules/validate-newline-after-array-elements')); this.registerRule(require('../rules/disallow-not-operators-in-conditionals')); }; |
| Function (anonymous_193) | |
|---|---|
| ✓ Was called | Configuration.prototype.registerDefaultPresets = function() {··· // https://github.com/airbnb/javascript this.registerPreset('airbnb', require('../../presets/airbnb.json')); // http://javascript.crockford.com/code.html this.registerPreset('crockford', require('../../presets/crockford.json')); // https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml this.registerPreset('google', require('../../presets/google.json')); // http://gruntjs.com/contributing#syntax this.registerPreset('grunt', require('../../presets/grunt.json')); // https://contribute.jquery.org/style-guide/js/ this.registerPreset('jquery', require('../../presets/jquery.json')); // https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2 this.registerPreset('mdcs', require('../../presets/mdcs.json')); // https://github.com/felixge/node-style-guide#nodejs-style-guide this.registerPreset('node-style-guide', require('../../presets/node-style-guide.json')); // https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript this.registerPreset('wikimedia', require('../../presets/wikimedia.json')); // https://make.wordpress.org/core/handbook/coding-standards/javascript/ this.registerPreset('wordpress', require('../../presets/wordpress.json')); // https://github.com/yandex/codestyle/blob/master/javascript.md this.registerPreset('yandex', require('../../presets/yandex.json')); }; |
| Function copyConfiguration | |
|---|---|
| ✓ Was called | function copyConfiguration(source, dest) {··· Object.keys(source).forEach(function(key) { dest[key] = source[key]; }); if (source.configPath) { dest.configPath = source.configPath; } } |
| Function (anonymous_195) | |
|---|---|
| ✓ Was called | Object.keys(source).forEach(function(key) {··· dest[key] = source[key]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (source.configPath) {··· dest.configPath = source.configPath; } |
| ✓ Negative was executed (else) | }··· } |
| Function NodeConfiguration | |
|---|---|
| ✓ Was called | function NodeConfiguration() {··· Configuration.call(this); this._basePath = process.cwd(); } |
| Function (anonymous_197) | |
|---|---|
| ✓ Was called | NodeConfiguration.prototype.overrideFromCLI = function(program) {··· var overrides = {}; OVERRIDE_OPTIONS.forEach(function(option) { if (program[option]) { overrides[option] = program[option]; } }); this.override(overrides); }; |
| Function (anonymous_198) | |
|---|---|
| ✓ Was called | OVERRIDE_OPTIONS.forEach(function(option) {··· if (program[option]) { overrides[option] = program[option]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (program[option]) {··· overrides[option] = program[option]; } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_199) | |
|---|---|
| ✓ Was called | NodeConfiguration.prototype._loadPlugin = function(plugin) {··· if (typeof plugin === 'string') { var pluginPath = utils.normalizePath(plugin, this._basePath); plugin = require(pluginPath); } Configuration.prototype._loadPlugin.call(this, plugin); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof plugin === 'string') {··· var pluginPath = utils.normalizePath(plugin, this._basePath); plugin = require(pluginPath); } |
| ✓ Negative was executed (else) | }··· Configuration.prototype._loadPlugin.call(this, plugin); |
| Function (anonymous_200) | |
|---|---|
| ✓ Was called | NodeConfiguration.prototype._loadErrorFilter = function(errorFilter) {··· assert( typeof errorFilter === 'string' || errorFilter === null, '`errorFilter` option requires a string or null value' ); if (errorFilter) { errorFilter = utils.normalizePath(errorFilter, this._basePath); errorFilter = require(errorFilter); } Configuration.prototype._loadErrorFilter.call(this, errorFilter); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof errorFilter === 'string' || errorFilter === null, |
| ✓ Was returned | typeof errorFilter === 'string' || errorFilter === null, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errorFilter) {··· errorFilter = utils.normalizePath(errorFilter, this._basePath); errorFilter = require(errorFilter); } |
| ✓ Negative was executed (else) | }··· Configuration.prototype._loadErrorFilter.call(this, errorFilter); |
| Function (anonymous_201) | |
|---|---|
| ✓ Was called | NodeConfiguration.prototype._loadEsprima = function(esprima) {··· assert( typeof esprima === 'string' || esprima === null, '`esprima` option requires a string or null value' ); if (esprima) { esprima = utils.normalizePath(esprima, this._basePath); esprima = require(esprima); } Configuration.prototype._loadEsprima.call(this, esprima); }; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | typeof esprima === 'string' || esprima === null, |
| ✓ Was returned | typeof esprima === 'string' || esprima === null, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (esprima) {··· esprima = utils.normalizePath(esprima, this._basePath); esprima = require(esprima); } |
| ✗ Negative was not executed (else) | }··· Configuration.prototype._loadEsprima.call(this, esprima); |
| Function (anonymous_202) | |
|---|---|
| ✓ Was called | NodeConfiguration.prototype._loadAdditionalRule = function(additionalRule) {··· if (typeof additionalRule === 'string') { glob.sync(path.resolve(this._basePath, additionalRule)).forEach(function(path) { var Rule = require(path); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); } else { Configuration.prototype._loadAdditionalRule.call(this, additionalRule); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof additionalRule === 'string') {··· glob.sync(path.resolve(this._basePath, additionalRule)).forEach(function(path) { var Rule = require(path); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); } else { |
| ✓ Negative was executed (else) | } else {··· Configuration.prototype._loadAdditionalRule.call(this, additionalRule); } |
| Function (anonymous_203) | |
|---|---|
| ✓ Was called | glob.sync(path.resolve(this._basePath, additionalRule)).forEach(function(path) {··· var Rule = require(path); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); |
| Function (anonymous_204) | |
|---|---|
| ✓ Was called | exports.isEs3Keyword = function(word) {··· return Boolean(ES3_KEYWORDS[word]); }; |
| Function (anonymous_205) | |
|---|---|
| ✓ Was called | exports.isEs3FutureReservedWord = function(word) {··· return Boolean(ES3_FUTURE_RESERVED_WORDS[word]); }; |
| Function (anonymous_206) | |
|---|---|
| ✓ Was called | exports.isValidIdentifierName = function(name) {··· return IDENTIFIER_NAME_RE.test(name); }; |
| Function (anonymous_207) | |
|---|---|
| ✓ Was called | exports.isSnakeCased = function(name) {··· return SNAKE_CASE_RE.test(name); }; |
| Function (anonymous_208) | |
|---|---|
| ✓ Was called | exports.getFunctionNodeFromIIFE = function(node) {··· if (node.type !== 'CallExpression') { return null; } var callee = node.callee; if (callee.type === 'FunctionExpression') { return callee; } if (callee.type === 'MemberExpression' && callee.object.type === 'FunctionExpression' && callee.property.type === 'Identifier' && (callee.property.name === 'call' || callee.property.name === 'apply') ) { return callee.object; } return null; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type !== 'CallExpression') {··· return null; } |
| ✓ Negative was executed (else) | }··· var callee = node.callee; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (callee.type === 'FunctionExpression') {··· return callee; } |
| ✓ Negative was executed (else) | }··· if (callee.type === 'MemberExpression' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· return callee.object; } |
| ✓ Negative was executed (else) | }··· return null; |
| Branch LogicalExpression | |
| ✓ Was returned | (callee.property.name === 'call' || callee.property.name === 'apply') |
| ✓ Was returned | if (callee.type === 'MemberExpression' &&··· callee.object.type === 'FunctionExpression' && callee.property.type === 'Identifier' && |
| Branch LogicalExpression | |
| ✓ Was returned | callee.property.type === 'Identifier' && |
| ✓ Was returned | if (callee.type === 'MemberExpression' &&··· callee.object.type === 'FunctionExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | callee.object.type === 'FunctionExpression' && |
| ✓ Was returned | if (callee.type === 'MemberExpression' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (callee.property.name === 'call' || callee.property.name === 'apply') |
| ✓ Was returned | (callee.property.name === 'call' || callee.property.name === 'apply') |
| Function (anonymous_209) | |
|---|---|
| ✓ Was called | exports.trimUnderscores = function(name) {··· var res = name.replace(TRAILING_UNDERSCORES_RE, ''); return res ? res : name; }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return res ? res : name; |
| ✓ Negative was returned (: ...) | return res ? res : name; |
| Function (anonymous_210) | |
|---|---|
| ✓ Was called | exports.isRelativePath = function(path) {··· // Logic from: https://github.com/joyent/node/blob/4f1ae11a62b97052bc83756f8cb8700cc1f61661/lib/module.js#L237 var start = path.substring(0, 2); return start === './' || start === '..'; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return start === './' || start === '..'; |
| ✓ Was returned | return start === './' || start === '..'; |
| Function (anonymous_211) | |
|---|---|
| ✓ Was called | exports.normalizePath = function(filepath, basePath) {··· if (this.isRelativePath(filepath)) { return path.resolve(basePath, filepath); } return filepath; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this.isRelativePath(filepath)) {··· return path.resolve(basePath, filepath); } |
| ✓ Negative was executed (else) | }··· return filepath; |
| Function (anonymous_212) | |
|---|---|
| ✓ Was called | exports.promisify = function(fn) {··· return function() { var deferred = Vow.defer(); var args = [].slice.call(arguments); args.push(function(err, result) { if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); fn.apply(null, args); return deferred.promise(); }; }; |
| Function (anonymous_213) | |
|---|---|
| ✓ Was called | return function() {··· var deferred = Vow.defer(); var args = [].slice.call(arguments); args.push(function(err, result) { if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); fn.apply(null, args); return deferred.promise(); }; |
| Function (anonymous_214) | |
|---|---|
| ✓ Was called | args.push(function(err, result) {··· if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (err) {··· deferred.reject(err); } else { |
| ✓ Negative was executed (else) | } else {··· deferred.resolve(result); } |
| Function findup | |
|---|---|
| ✓ Was called | function findup(patterns, options, fn) {··· /* jshint -W083 */ var lastpath; var file; options = Object.create(options); options.maxDepth = 1; options.cwd = path.resolve(options.cwd); do { file = patterns.filter(function(pattern) { var configPath = glob.sync(pattern, options)[0]; if (configPath) { return fn(path.join(options.cwd, configPath)); } })[0]; if (file) { return path.join(options.cwd, file); } lastpath = options.cwd; options.cwd = path.resolve(options.cwd, '..'); } while (options.cwd !== lastpath); } |
| Function (anonymous_216) | |
|---|---|
| ✓ Was called | file = patterns.filter(function(pattern) {··· var configPath = glob.sync(pattern, options)[0]; if (configPath) { return fn(path.join(options.cwd, configPath)); } })[0]; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (configPath) {··· return fn(path.join(options.cwd, configPath)); } |
| ✓ Negative was executed (else) | }··· })[0]; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (file) {··· return path.join(options.cwd, file); } |
| ✓ Negative was executed (else) | }··· lastpath = options.cwd; |
| Function (anonymous_217) | |
|---|---|
| ✓ Was called | exports.getContent = function(config, directory) {··· if (!config) { return; } var configPath = path.resolve(directory, config); var ext; var content; config = path.basename(config); if (fs.existsSync(configPath)) { ext = path.extname(configPath); if (ext === '.js' || ext === '.json') { content = require(configPath); } else { content = JSON.parse( stripJSONComments( fs.readFileSync(configPath, 'utf8') ) ); } // Adding property via Object.defineProperty makes it // non-enumerable and avoids warning for unsupported rules Object.defineProperty(content, 'configPath', { value: configPath }); } return content && config === 'package.json' ? content.jscsConfig : content; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!config) {··· return; } |
| ✓ Negative was executed (else) | }··· var configPath = path.resolve(directory, config); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (fs.existsSync(configPath)) {··· ext = path.extname(configPath); if (ext === '.js' || ext === '.json') { content = require(configPath); } else { content = JSON.parse( stripJSONComments( fs.readFileSync(configPath, 'utf8') ) ); } // Adding property via Object.defineProperty makes it // non-enumerable and avoids warning for unsupported rules Object.defineProperty(content, 'configPath', { value: configPath }); } |
| ✓ Negative was executed (else) | }··· return content && config === 'package.json' ? content.jscsConfig : content; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (ext === '.js' || ext === '.json') {··· content = require(configPath); } else { |
| ✓ Negative was executed (else) | } else {··· content = JSON.parse( stripJSONComments( fs.readFileSync(configPath, 'utf8') ) ); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (ext === '.js' || ext === '.json') { |
| ✓ Was returned | if (ext === '.js' || ext === '.json') { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return content && config === 'package.json' ? content.jscsConfig : content; |
| ✓ Negative was returned (: ...) | return content && config === 'package.json' ? content.jscsConfig : content; |
| Branch LogicalExpression | |
| ✓ Was returned | return content && config === 'package.json' ? content.jscsConfig : content; |
| ✓ Was returned | return content && config === 'package.json' ? content.jscsConfig : content; |
| Function (anonymous_218) | |
|---|---|
| ✓ Was called | exports.load = function(config, cwd) {··· var content; var directory = cwd || process.cwd(); // If config option is given, attempt to load it if (config) { return this.getContent(config, directory); } content = this.getContent( findup(configs, { nocase: true, cwd: directory }, function(configPath) { if (path.basename(configPath) === 'package.json') { return !!this.getContent(configPath); } return true; }.bind(this)) ); if (content) { return content; } // Try to load standard configs from home dir var directoryArr = [process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOME]; for (var i = 0, dirLen = directoryArr.length; i < dirLen; i++) { if (!directoryArr[i]) { continue; } for (var j = 0, len = configs.length; j < len; j++) { content = this.getContent(configs[j], directoryArr[i]); if (content) { return content; } } } }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var directory = cwd || process.cwd(); |
| ✓ Was returned | var directory = cwd || process.cwd(); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (config) {··· return this.getContent(config, directory); } |
| ✓ Negative was executed (else) | }··· content = this.getContent( |
| Function (anonymous_219) | |
|---|---|
| ✓ Was called | findup(configs, { nocase: true, cwd: directory }, function(configPath) {··· if (path.basename(configPath) === 'package.json') { return !!this.getContent(configPath); } return true; }.bind(this)) |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (path.basename(configPath) === 'package.json') {··· return !!this.getContent(configPath); } |
| ✓ Negative was executed (else) | }··· return true; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (content) {··· return content; } |
| ✓ Negative was executed (else) | }··· // Try to load standard configs from home dir |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!directoryArr[i]) {··· continue; } |
| ✓ Negative was executed (else) | }··· for (var j = 0, len = configs.length; j < len; j++) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (content) {··· return content; } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_220) | |
|---|---|
| ✓ Was called | exports.getReporter = function(reporter, colors) {··· var writerPath; var writer; if (colors !== false) { colors = true; } if (reporter) { // ensure reporter is a string (and allow non-string types to be coerced) reporter = reporter.toString(); writerPath = path.resolve(process.cwd(), reporter); if (!fs.existsSync(writerPath)) { writerPath = path.resolve(__dirname, './reporters/' + reporter); } } else { writerPath = path.resolve( __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') ); } try { writer = require(writerPath); } catch (e) { writer = null; } return { path: writerPath, writer: writer }; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (colors !== false) {··· colors = true; } |
| ✓ Negative was executed (else) | }··· if (reporter) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (reporter) {··· // ensure reporter is a string (and allow non-string types to be coerced) reporter = reporter.toString(); writerPath = path.resolve(process.cwd(), reporter); if (!fs.existsSync(writerPath)) { writerPath = path.resolve(__dirname, './reporters/' + reporter); } } else { |
| ✓ Negative was executed (else) | } else {··· writerPath = path.resolve( __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!fs.existsSync(writerPath)) {··· writerPath = path.resolve(__dirname, './reporters/' + reporter); } |
| ✓ Negative was executed (else) | }··· } else { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') |
| ✓ Negative was returned (: ...) | __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') |
| Branch LogicalExpression | |
| ✓ Was returned | __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') |
| ✓ Was returned | __dirname, './reporters/', (colors && supportsColor ? 'console' : 'text') |
| Function (anonymous_221) | |
|---|---|
| ✓ Was called | module.exports = function(program) {··· var reporter; var config; var checkerPromise; var defer = Vow.defer(); var promise = defer.promise(); var checker = new Checker(); var args = program.args; var returnArgs = { checker: checker, reporter: program.reporter, promise: promise }; promise.always(function(status) { exit(status.valueOf()); }); try { config = configFile.load(program.config); } catch (e) { console.error('Config source is corrupted -', e.toString()); defer.reject(1); return returnArgs; } /** * Trying to load config. * Custom config path can be specified using '-c' option. */ if (!config && !program.preset && !program.autoConfigure) { if (program.config) { console.error('Configuration source', program.config, 'was not found.'); } else { console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } defer.reject(1); return returnArgs; } if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { console.error('No input files specified. Try option --help for usage information.'); defer.reject(1); return returnArgs; } reporter = configFile.getReporter(program.reporter, program.colors); returnArgs.reporter = reporter.path; if (!reporter.writer) { console.error('Reporter "%s" doesn\'t exist.', reporter.writer); returnArgs.reporter = reporter.path; defer.reject(1); return returnArgs; } if (!config) { config = {}; } checker.getConfiguration().overrideFromCLI(program); checker.getConfiguration().registerDefaultRules(); try { checker.configure(config); } catch (e) { console.error(e.message); defer.reject(1); return returnArgs; } if (program.autoConfigure) { var generator = new ConfigGenerator(); generator .generate(program.autoConfigure) .then(function() { defer.resolve(0); }, function(error) { console.error('Configuration generation failed due to ', error); defer.reject(1); }); return returnArgs; } // Handle usage like 'cat myfile.js | jscs' or 'jscs -'' var usedDash = args[args.length - 1] === '-'; if (!args.length || usedDash) { // So the dash doesn't register as a file if (usedDash) { args.length--; } if (program.fix) { return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } checkerPromise = checker.checkStdin().then(function(errors) { return [errors]; }); } // Processing specified files and dirs. if (args.length) { var method = program.fix ? checker.fixPath : checker.checkPath; checkerPromise = Vow.all(args.map(method, checker)).then(function(results) { return [].concat.apply([], results); }); } checkerPromise.then(function(errorsCollection) { reporter.writer(errorsCollection); handleMaxErrors(); errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { defer.reject(2); } }); defer.resolve(0); }).fail(function(e) { console.error(e.stack); defer.reject(1); }); return returnArgs; function handleMaxErrors() { if (checker.maxErrorsExceeded()) { console.log('Too many errors... Increase `maxErrors` configuration option value to see more.'); } } }; |
| Function (anonymous_222) | |
|---|---|
| ✓ Was called | promise.always(function(status) {··· exit(status.valueOf()); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!config && !program.preset && !program.autoConfigure) {··· if (program.config) { console.error('Configuration source', program.config, 'was not found.'); } else { console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } defer.reject(1); return returnArgs; } |
| ✓ Negative was executed (else) | }··· if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!config && !program.preset && !program.autoConfigure) { |
| ✓ Was returned | if (!config && !program.preset && !program.autoConfigure) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!config && !program.preset && !program.autoConfigure) { |
| ✓ Was returned | if (!config && !program.preset && !program.autoConfigure) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (program.config) {··· console.error('Configuration source', program.config, 'was not found.'); } else { |
| ✓ Negative was executed (else) | } else {··· console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') {··· console.error('No input files specified. Try option --help for usage information.'); defer.reject(1); return returnArgs; } |
| ✓ Negative was executed (else) | }··· reporter = configFile.getReporter(program.reporter, program.colors); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| ✓ Was returned | if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| ✓ Was returned | if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!reporter.writer) {··· console.error('Reporter "%s" doesn\'t exist.', reporter.writer); returnArgs.reporter = reporter.path; defer.reject(1); return returnArgs; } |
| ✓ Negative was executed (else) | }··· if (!config) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!config) {··· config = {}; } |
| ✓ Negative was executed (else) | }··· checker.getConfiguration().overrideFromCLI(program); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (program.autoConfigure) {··· var generator = new ConfigGenerator(); generator .generate(program.autoConfigure) .then(function() { defer.resolve(0); }, function(error) { console.error('Configuration generation failed due to ', error); defer.reject(1); }); return returnArgs; } |
| ✓ Negative was executed (else) | }··· // Handle usage like 'cat myfile.js | jscs' or 'jscs -'' |
| Function (anonymous_223) | |
|---|---|
| ✓ Was called | .then(function() {··· defer.resolve(0); }, function(error) { |
| Function (anonymous_224) | |
|---|---|
| ✓ Was called | }, function(error) {··· console.error('Configuration generation failed due to ', error); defer.reject(1); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!args.length || usedDash) {··· // So the dash doesn't register as a file if (usedDash) { args.length--; } if (program.fix) { return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } checkerPromise = checker.checkStdin().then(function(errors) { return [errors]; }); } |
| ✓ Negative was executed (else) | }··· // Processing specified files and dirs. |
| Branch LogicalExpression | |
| ✓ Was returned | if (!args.length || usedDash) { |
| ✓ Was returned | if (!args.length || usedDash) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (usedDash) { args.length--; } |
| ✓ Negative was executed (else) | if (usedDash) { args.length--; }··· if (program.fix) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (program.fix) {··· return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } |
| ✓ Negative was executed (else) | }··· checkerPromise = checker.checkStdin().then(function(errors) { |
| Function (anonymous_225) | |
|---|---|
| ✗ Was not called | promise: checker.fixStdin().then(function(result) {··· process.stdout.write(result.output); }), |
| Function (anonymous_226) | |
|---|---|
| ✓ Was called | checkerPromise = checker.checkStdin().then(function(errors) {··· return [errors]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (args.length) {··· var method = program.fix ? checker.fixPath : checker.checkPath; checkerPromise = Vow.all(args.map(method, checker)).then(function(results) { return [].concat.apply([], results); }); } |
| ✓ Negative was executed (else) | }··· checkerPromise.then(function(errorsCollection) { |
| Branch ConditionalExpression | |
|---|---|
| ✗ Positive was not returned (? ...) | var method = program.fix ? checker.fixPath : checker.checkPath; |
| ✓ Negative was returned (: ...) | var method = program.fix ? checker.fixPath : checker.checkPath; |
| Function (anonymous_227) | |
|---|---|
| ✓ Was called | checkerPromise = Vow.all(args.map(method, checker)).then(function(results) {··· return [].concat.apply([], results); }); |
| Function (anonymous_228) | |
|---|---|
| ✓ Was called | checkerPromise.then(function(errorsCollection) {··· reporter.writer(errorsCollection); handleMaxErrors(); errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { defer.reject(2); } }); defer.resolve(0); }).fail(function(e) { |
| Function (anonymous_229) | |
|---|---|
| ✓ Was called | errorsCollection.forEach(function(errors) {··· if (!errors.isEmpty()) { defer.reject(2); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!errors.isEmpty()) {··· defer.reject(2); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_230) | |
|---|---|
| ✓ Was called | }).fail(function(e) {··· console.error(e.stack); defer.reject(1); }); |
| Function handleMaxErrors | |
|---|---|
| ✓ Was called | function handleMaxErrors() {··· if (checker.maxErrorsExceeded()) { console.log('Too many errors... Increase `maxErrors` configuration option value to see more.'); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (checker.maxErrorsExceeded()) {··· console.log('Too many errors... Increase `maxErrors` configuration option value to see more.'); } |
| ✓ Negative was executed (else) | }··· } |
| Function Generator | |
|---|---|
| ✓ Was called | function Generator() {··· this._config = {}; } |
| Function (anonymous_239) | |
|---|---|
| ✓ Was called | Generator.prototype.generate = function(path) {··· var checker = getChecker(); var _path = utils.normalizePath(path, checker.getConfiguration().getBasePath()); var presetNames = Object.keys(checker.getConfiguration().getRegisteredPresets()); var statsForPresets; console.log('Checking', _path, 'against the presets'); return Vow .all(presetNames.map(this._checkAgainstPreset.bind(this, _path))) .then(function(resultsPerPreset) { statsForPresets = this._generateStatsForPresets(resultsPerPreset, presetNames); return statsForPresets; }.bind(this)) .then(this._showErrorCounts.bind(this)) .then(this._getUserPresetChoice.bind(this, prompts[0])) .then(function showViolatedRules(choiceObj) { var presetIndex = choiceObj[prompts[0].name] - 1; var presetName = statsForPresets[presetIndex].name; console.log('You chose the ' + presetName + ' preset'); this._config.preset = presetName; var errorStats = getErrorsByRuleName(statsForPresets[presetIndex].errors); var violatedRuleCount = Object.keys(errorStats).length; if (!violatedRuleCount) { return this._config; } console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); var errorPrompts = generateRuleHandlingPrompts(errorStats); return this._getUserViolationChoices(errorPrompts) .then(this._handleViolatedRules.bind(this, errorPrompts)) .then(function() { return this._config; }.bind(this)); }.bind(this)) .then(function flushConfig() { fs.writeFileSync(process.cwd() + '/.jscsrc', JSON.stringify(this._config, null, '\t')); console.log('Generated a .jscsrc configuration file in ' + process.cwd()); }.bind(this)); }; |
| Function (anonymous_240) | |
|---|---|
| ✓ Was called | .then(function(resultsPerPreset) {··· statsForPresets = this._generateStatsForPresets(resultsPerPreset, presetNames); return statsForPresets; }.bind(this)) |
| Function showViolatedRules | |
|---|---|
| ✓ Was called | .then(function showViolatedRules(choiceObj) {··· var presetIndex = choiceObj[prompts[0].name] - 1; var presetName = statsForPresets[presetIndex].name; console.log('You chose the ' + presetName + ' preset'); this._config.preset = presetName; var errorStats = getErrorsByRuleName(statsForPresets[presetIndex].errors); var violatedRuleCount = Object.keys(errorStats).length; if (!violatedRuleCount) { return this._config; } console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); var errorPrompts = generateRuleHandlingPrompts(errorStats); return this._getUserViolationChoices(errorPrompts) .then(this._handleViolatedRules.bind(this, errorPrompts)) .then(function() { return this._config; }.bind(this)); }.bind(this)) |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (!violatedRuleCount) { return this._config; } |
| ✓ Negative was executed (else) | if (!violatedRuleCount) { return this._config; }··· console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); |
| ✗ Negative was not returned (: ...) | console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); |
| Function (anonymous_242) | |
|---|---|
| ✓ Was called | .then(function() {··· return this._config; }.bind(this)); |
| Function flushConfig | |
|---|---|
| ✓ Was called | .then(function flushConfig() {··· fs.writeFileSync(process.cwd() + '/.jscsrc', JSON.stringify(this._config, null, '\t')); console.log('Generated a .jscsrc configuration file in ' + process.cwd()); }.bind(this)); |
| Function (anonymous_244) | |
|---|---|
| ✓ Was called | Generator.prototype._generateStatsForPresets = function(resultsPerPreset, presetNames) {··· return resultsPerPreset.map(function(presetResults, idx) { var errorCollection = [].concat.apply([], presetResults); var presetStats = { name: presetNames[idx], sum: 0, errors: [] }; errorCollection.forEach(function(error) { presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); return presetStats; }); }; |
| Function (anonymous_245) | |
|---|---|
| ✓ Was called | return resultsPerPreset.map(function(presetResults, idx) {··· var errorCollection = [].concat.apply([], presetResults); var presetStats = { name: presetNames[idx], sum: 0, errors: [] }; errorCollection.forEach(function(error) { presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); return presetStats; }); |
| Function (anonymous_246) | |
|---|---|
| ✓ Was called | errorCollection.forEach(function(error) {··· presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); |
| Function (anonymous_247) | |
|---|---|
| ✓ Was called | Generator.prototype._showErrorCounts = function(statsForPresets) {··· var table = getTable(); statsForPresets.forEach(function(presetStats, idx) { table.push([idx + 1, presetStats.name, presetStats.sum, getUniqueErrorNames(presetStats.errors).length]); }); console.log(table.toString()); }; |
| Function (anonymous_248) | |
|---|---|
| ✓ Was called | statsForPresets.forEach(function(presetStats, idx) {··· table.push([idx + 1, presetStats.name, presetStats.sum, getUniqueErrorNames(presetStats.errors).length]); }); |
| Function (anonymous_249) | |
|---|---|
| ✓ Was called | Generator.prototype._getUserPresetChoice = function(prompt) {··· return this._showPrompt(prompt); }; |
| Function (anonymous_250) | |
|---|---|
| ✓ Was called | Generator.prototype._getUserViolationChoices = function(errorPrompts) {··· return this._showPrompt(errorPrompts); }; |
| Function (anonymous_251) | |
|---|---|
| ✓ Was called | Generator.prototype._handleViolatedRules = function(errorPrompts, choices) {··· errorPrompts.forEach(function(errorPrompt) { var userChoice = choices[errorPrompt.name]; if (userChoice.toLowerCase() === 'e') { this._config[errorPrompt.associatedRuleName] = null; } }, this); }; |
| Function (anonymous_252) | |
|---|---|
| ✓ Was called | errorPrompts.forEach(function(errorPrompt) {··· var userChoice = choices[errorPrompt.name]; if (userChoice.toLowerCase() === 'e') { this._config[errorPrompt.associatedRuleName] = null; } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (userChoice.toLowerCase() === 'e') {··· this._config[errorPrompt.associatedRuleName] = null; } |
| ✗ Negative was not executed (else) | }··· }, this); |
| Function (anonymous_253) | |
|---|---|
| ✓ Was called | Generator.prototype._checkAgainstPreset = function(path, presetName) {··· var checker = getChecker(); checker.configure({preset: presetName}); return checker.checkPath(path); }; |
| Function getChecker | |
|---|---|
| ✓ Was called | function getChecker() {··· var checker = new Checker(); checker.registerDefaultRules(); return checker; } |
| Function generateRuleHandlingPrompts | |
|---|---|
| ✓ Was called | function generateRuleHandlingPrompts(errors) {··· // Generate list of rule names, sorted by violation count (descending) var violatedRuleNames = Object.keys(errors); violatedRuleNames.sort(function(a, b) { return errors[b].violations - errors[a].violations; }); return violatedRuleNames.map(function(ruleName) { var violationCount = errors[ruleName].violations; var fileCount = Object.keys(errors[ruleName].files).length; var prompt = assign({}, prompts[1]); prompt.associatedRuleName = ruleName; prompt.name = chalk.green(ruleName) + ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + prompt.name; return prompt; }); } |
| Function (anonymous_256) | |
|---|---|
| ✓ Was called | violatedRuleNames.sort(function(a, b) {··· return errors[b].violations - errors[a].violations; }); |
| Function (anonymous_257) | |
|---|---|
| ✓ Was called | return violatedRuleNames.map(function(ruleName) {··· var violationCount = errors[ruleName].violations; var fileCount = Object.keys(errors[ruleName].files).length; var prompt = assign({}, prompts[1]); prompt.associatedRuleName = ruleName; prompt.name = chalk.green(ruleName) + ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + prompt.name; return prompt; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + |
| ✓ Negative was returned (: ...) | ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + |
| Branch ConditionalExpression | |
|---|---|
| ✗ Positive was not returned (? ...) | ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + |
| ✓ Negative was returned (: ...) | ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + |
| Function getErrorsByRuleName | |
|---|---|
| ✓ Was called | function getErrorsByRuleName(errorsList) {··· var errors = {}; errorsList.forEach(function(error) { var rulename = error.rule; errors[rulename] = errors[rulename] || { files: {}, violations: 0 }; errors[rulename].violations += 1; errors[rulename].files[error.filename] = true; }); return errors; } |
| Function (anonymous_259) | |
|---|---|
| ✓ Was called | errorsList.forEach(function(error) {··· var rulename = error.rule; errors[rulename] = errors[rulename] || { files: {}, violations: 0 }; errors[rulename].violations += 1; errors[rulename].files[error.filename] = true; }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | errors[rulename] = errors[rulename] || {··· files: {}, violations: 0 }; |
| ✓ Was returned | errors[rulename] = errors[rulename] || { |
| Function getUniqueErrorNames | |
|---|---|
| ✓ Was called | function getUniqueErrorNames(errorsList) {··· var errorNameLUT = {}; errorsList.forEach(function(error) { errorNameLUT[error.rule] = true; }); return Object.keys(errorNameLUT); } |
| Function (anonymous_261) | |
|---|---|
| ✓ Was called | errorsList.forEach(function(error) {··· errorNameLUT[error.rule] = true; }); |
| Function getTable | |
|---|---|
| ✓ Was called | function getTable() {··· return new Table({ chars: { top: '', 'top-mid': '', 'top-left': '', 'top-right': '', bottom: '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '', left: '', 'left-mid': '', mid: '', 'mid-mid': '', right: '', 'right-mid': '' , middle: ' ' }, style: { 'padding-left': 0, 'padding-right': 0 }, head: ['', 'Preset', '#Errors', '#Rules'] }); } |
| Function escapeAttrValue | |
|---|---|
| ✓ Was called | function escapeAttrValue(attrValue) {··· return String(attrValue) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/</g, '<') .replace(/>/g, '>'); } |
| Function (anonymous_264) | |
|---|---|
| ✓ Was called | module.exports = function(errorCollection) {··· console.log('<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="4.3">'); errorCollection.forEach(function(errors) { console.log(' <file name="' + escapeAttrValue(errors.getFilename()) + '">'); errors.getErrorList().forEach(function(error) { console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); console.log(' </file>'); }); console.log('</checkstyle>'); }; |
| Function (anonymous_265) | |
|---|---|
| ✓ Was called | errorCollection.forEach(function(errors) {··· console.log(' <file name="' + escapeAttrValue(errors.getFilename()) + '">'); errors.getErrorList().forEach(function(error) { console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); console.log(' </file>'); }); |
| Function (anonymous_266) | |
|---|---|
| ✓ Was called | errors.getErrorList().forEach(function(error) {··· console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); |
| Function (anonymous_267) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_268) | |
|---|---|
| ✓ Was called | configure: function(statementTypes) {··· assert( Array.isArray(statementTypes) || statementTypes === true, this.getOptionName() + ' option requires array or true value' ); if (statementTypes === true) { statementTypes = defaultKeywords; } this._typeIndex = {}; for (var i = 0, l = statementTypes.length; i < l; i++) { this._typeIndex[statementTypes[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(statementTypes) || statementTypes === true, |
| ✓ Was returned | Array.isArray(statementTypes) || statementTypes === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (statementTypes === true) {··· statementTypes = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._typeIndex = {}; |
| Function (anonymous_269) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireCurlyBraces'; }, |
| Function (anonymous_270) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· function isNotABlockStatement(node) { return node && node.type !== 'BlockStatement'; } function addError(typeString, entity) { errors.add( typeString + ' statement without curly braces', entity.loc.start.line, entity.loc.start.column ); } function checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); } var typeIndex = this._typeIndex; if (typeIndex['if'] || typeIndex['else']) { file.iterateNodesByType('IfStatement', function(node) { if (typeIndex['if'] && isNotABlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement') { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } if (typeIndex['case'] || typeIndex['default']) { file.iterateNodesByType('SwitchCase', function(node) { // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex['default']) { addError('Default', node); } if (node.test !== null && typeIndex['case']) { addError('Case', node); } }); } if (typeIndex['while']) { checkBody('WhileStatement', 'While'); } if (typeIndex['for']) { checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); } if (typeIndex['do']) { checkBody('DoWhileStatement', 'Do while'); } if (typeIndex['with']) { checkBody('WithStatement', 'With'); } } |
| Function isNotABlockStatement | |
|---|---|
| ✓ Was called | function isNotABlockStatement(node) {··· return node && node.type !== 'BlockStatement'; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return node && node.type !== 'BlockStatement'; |
| ✓ Was returned | return node && node.type !== 'BlockStatement'; |
| Function addError | |
|---|---|
| ✓ Was called | function addError(typeString, entity) {··· errors.add( typeString + ' statement without curly braces', entity.loc.start.line, entity.loc.start.column ); } |
| Function checkBody | |
|---|---|
| ✓ Was called | function checkBody(type, typeString) {··· file.iterateNodesByType(type, function(node) { if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); } |
| Function (anonymous_274) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(type, function(node) {··· if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isNotABlockStatement(node.body)) {··· addError(typeString, node); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['if'] || typeIndex['else']) {··· file.iterateNodesByType('IfStatement', function(node) { if (typeIndex['if'] && isNotABlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement') { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['case'] || typeIndex['default']) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['if'] || typeIndex['else']) { |
| ✓ Was returned | if (typeIndex['if'] || typeIndex['else']) { |
| Function (anonymous_275) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('IfStatement', function(node) {··· if (typeIndex['if'] && isNotABlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement') { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['if'] && isNotABlockStatement(node.consequent)) {··· addError('If', node); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['else'] && isNotABlockStatement(node.alternate) && |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['if'] && isNotABlockStatement(node.consequent)) { |
| ✓ Was returned | if (typeIndex['if'] && isNotABlockStatement(node.consequent)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.alternate.type !== 'IfStatement') {··· addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | node.alternate.type !== 'IfStatement') { |
| ✓ Was returned | if (typeIndex['else'] && isNotABlockStatement(node.alternate) && |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['else'] && isNotABlockStatement(node.alternate) && |
| ✓ Was returned | if (typeIndex['else'] && isNotABlockStatement(node.alternate) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['case'] || typeIndex['default']) {··· file.iterateNodesByType('SwitchCase', function(node) { // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex['default']) { addError('Default', node); } if (node.test !== null && typeIndex['case']) { addError('Case', node); } }); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['while']) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['case'] || typeIndex['default']) { |
| ✓ Was returned | if (typeIndex['case'] || typeIndex['default']) { |
| Function (anonymous_276) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('SwitchCase', function(node) {··· // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex['default']) { addError('Default', node); } if (node.test !== null && typeIndex['case']) { addError('Case', node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.consequent.length === 0) {··· return; } |
| ✓ Negative was executed (else) | }··· if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') {··· return; } |
| ✓ Negative was executed (else) | }··· if (node.test === null && typeIndex['default']) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { |
| ✓ Was returned | if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.test === null && typeIndex['default']) {··· addError('Default', node); } |
| ✓ Negative was executed (else) | }··· if (node.test !== null && typeIndex['case']) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.test === null && typeIndex['default']) { |
| ✓ Was returned | if (node.test === null && typeIndex['default']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.test !== null && typeIndex['case']) {··· addError('Case', node); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.test !== null && typeIndex['case']) { |
| ✓ Was returned | if (node.test !== null && typeIndex['case']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['while']) {··· checkBody('WhileStatement', 'While'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['for']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['for']) {··· checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['do']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['do']) {··· checkBody('DoWhileStatement', 'Do while'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['with']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['with']) {··· checkBody('WithStatement', 'With'); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_277) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_278) | |
|---|---|
| ✓ Was called | configure: function(statementTypes) {··· assert( Array.isArray(statementTypes) || statementTypes === true, this.getOptionName() + ' option requires array or true value' ); if (statementTypes === true) { statementTypes = defaultKeywords; } this._typeIndex = {}; statementTypes.forEach(function(type) { this._typeIndex[type] = true; }.bind(this)); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(statementTypes) || statementTypes === true, |
| ✓ Was returned | Array.isArray(statementTypes) || statementTypes === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (statementTypes === true) {··· statementTypes = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._typeIndex = {}; |
| Function (anonymous_279) | |
|---|---|
| ✓ Was called | statementTypes.forEach(function(type) {··· this._typeIndex[type] = true; }.bind(this)); |
| Function (anonymous_280) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowCurlyBraces'; }, |
| Function (anonymous_281) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· function isSingleBlockStatement(node) { return node && node.type === 'BlockStatement' && node.body.length === 1; } function addError(typeString, entity) { errors.add( typeString + ' statement with extra curly braces', entity.loc.start.line, entity.loc.start.column ); } function checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); } var typeIndex = this._typeIndex; if (typeIndex['if'] || typeIndex['else']) { file.iterateNodesByType('IfStatement', function(node) { if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } if (typeIndex['while']) { checkBody('WhileStatement', 'While'); } if (typeIndex['for']) { checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); } if (typeIndex['do']) { checkBody('DoWhileStatement', 'Do while'); } if (typeIndex['with']) { checkBody('WithStatement', 'With'); } } |
| Function isSingleBlockStatement | |
|---|---|
| ✓ Was called | function isSingleBlockStatement(node) {··· return node && node.type === 'BlockStatement' && node.body.length === 1; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | node.body.length === 1; |
| ✓ Was returned | return node && node.type === 'BlockStatement' && |
| Branch LogicalExpression | |
| ✓ Was returned | return node && node.type === 'BlockStatement' && |
| ✓ Was returned | return node && node.type === 'BlockStatement' && |
| Function addError | |
|---|---|
| ✓ Was called | function addError(typeString, entity) {··· errors.add( typeString + ' statement with extra curly braces', entity.loc.start.line, entity.loc.start.column ); } |
| Function checkBody | |
|---|---|
| ✓ Was called | function checkBody(type, typeString) {··· file.iterateNodesByType(type, function(node) { if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); } |
| Function (anonymous_285) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(type, function(node) {··· if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isSingleBlockStatement(node.body)) {··· addError(typeString, node); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['if'] || typeIndex['else']) {··· file.iterateNodesByType('IfStatement', function(node) { if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['while']) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['if'] || typeIndex['else']) { |
| ✓ Was returned | if (typeIndex['if'] || typeIndex['else']) { |
| Function (anonymous_286) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('IfStatement', function(node) {··· if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) {··· addError('If', node); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) { |
| ✓ Was returned | if (typeIndex['if'] && isSingleBlockStatement(node.consequent)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) {··· addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { |
| ✓ Was returned | if (typeIndex['else'] && isSingleBlockStatement(node.alternate)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['while']) {··· checkBody('WhileStatement', 'While'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['for']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['for']) {··· checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['do']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['do']) {··· checkBody('DoWhileStatement', 'Do while'); } |
| ✓ Negative was executed (else) | }··· if (typeIndex['with']) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeIndex['with']) {··· checkBody('WithStatement', 'With'); } |
| ✓ Negative was executed (else) | }··· } |
| Function consecutive | |
|---|---|
| ✓ Was called | function consecutive(file, errors) {··· file.iterateNodesByType('VariableDeclaration', function(node) { var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); } |
| Function (anonymous_288) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('VariableDeclaration', function(node) {··· var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (pos < node.parentCollection.length - 1) {··· var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) {··· errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { |
| ✓ Was returned | if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { |
| Function onevar | |
|---|---|
| ✓ Was called | function onevar(file, errors) {··· file.iterateNodesByType(['Program', 'FunctionDeclaration', 'FunctionExpression'], function(node) { var firstVar = true; var firstConst = true; var firstParent = true; file.iterate(function(node) { var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); }); } |
| Function (anonymous_290) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['Program', 'FunctionDeclaration', 'FunctionExpression'], function(node) {··· var firstVar = true; var firstConst = true; var firstParent = true; file.iterate(function(node) { var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); }); |
| Function (anonymous_291) | |
|---|---|
| ✓ Was called | file.iterate(function(node) {··· var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) {··· return false; } |
| ✓ Negative was executed (else) | }··· if (firstParent) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { |
| ✓ Was returned | if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (firstParent) {··· firstParent = false; } |
| ✓ Negative was executed (else) | }··· if (type === 'VariableDeclaration') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (type === 'VariableDeclaration') {··· if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } |
| ✓ Negative was executed (else) | }··· }, node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (kind === 'var') {··· if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } |
| ✓ Negative was executed (else) | }··· if (kind === 'const') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!firstVar) {··· errors.add( 'Var declarations should be joined', node.loc.start ); } else { |
| ✓ Negative was executed (else) | } else {··· firstVar = false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (kind === 'const') {··· if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!firstConst) {··· errors.add( 'Const declarations should be joined', node.loc.start ); } else { |
| ✓ Negative was executed (else) | } else {··· firstConst = false; } |
| Function (anonymous_292) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_293) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'onevar', this.getOptionName() + ' option requires a true value or `onevar`' ); this._check = typeof options === 'string' ? onevar : consecutive; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'onevar', |
| ✓ Was returned | options === true || options === 'onevar', |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | this._check = typeof options === 'string' ? onevar : consecutive; |
| ✓ Negative was returned (: ...) | this._check = typeof options === 'string' ? onevar : consecutive; |
| Function (anonymous_294) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireMultipleVarDecl'; }, |
| Function (anonymous_295) | |
|---|---|
| ✓ Was called | check: function() {··· return this._check.apply(this, arguments); } |
| Function (anonymous_296) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_297) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'strict' || options === 'exceptUndefined', this.getOptionName() + ' option requires a true value, "strict", or "exceptUndefined"' ); this.strictMode = options === 'strict'; this.exceptUndefined = options === 'exceptUndefined'; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === 'exceptUndefined', |
| ✓ Was returned | options === true ||··· options === 'strict' || |
| Branch LogicalExpression | |
| ✓ Was returned | options === 'strict' || |
| ✓ Was returned | options === true || |
| Function (anonymous_298) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowMultipleVarDecl'; }, |
| Function (anonymous_299) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var inStrictMode = this.strictMode; var exceptUndefined = this.exceptUndefined; file.iterateNodesByType('VariableDeclaration', function(node) { var hasDefinedVariables = node.declarations.some(function(declaration) { return !!declaration.init; }); var isForStatement = node.parentNode.type === 'ForStatement'; // allow single var declarations if (node.declarations.length === 1 || // allow multiple var declarations in for statement unless we're in strict mode // for (var i = 0, j = myArray.length; i < j; i++) {} !inStrictMode && isForStatement || // allow multiple var declarations with all undefined variables in exceptUndefined mode // var a, b, c exceptUndefined && !hasDefinedVariables) { return; } errors.add('Multiple var declaration', node.loc.start); }); } |
| Function (anonymous_300) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('VariableDeclaration', function(node) {··· var hasDefinedVariables = node.declarations.some(function(declaration) { return !!declaration.init; }); var isForStatement = node.parentNode.type === 'ForStatement'; // allow single var declarations if (node.declarations.length === 1 || // allow multiple var declarations in for statement unless we're in strict mode // for (var i = 0, j = myArray.length; i < j; i++) {} !inStrictMode && isForStatement || // allow multiple var declarations with all undefined variables in exceptUndefined mode // var a, b, c exceptUndefined && !hasDefinedVariables) { return; } errors.add('Multiple var declaration', node.loc.start); }); |
| Function (anonymous_301) | |
|---|---|
| ✓ Was called | var hasDefinedVariables = node.declarations.some(function(declaration) {··· return !!declaration.init; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | exceptUndefined && !hasDefinedVariables) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.add('Multiple var declaration', node.loc.start); |
| Branch LogicalExpression | |
| ✓ Was returned | exceptUndefined && !hasDefinedVariables) { |
| ✓ Was returned | if (node.declarations.length === 1 ||··· // allow multiple var declarations in for statement unless we're in strict mode // for (var i = 0, j = myArray.length; i < j; i++) {} !inStrictMode && isForStatement || |
| Branch LogicalExpression | |
| ✓ Was returned | !inStrictMode && isForStatement || |
| ✓ Was returned | if (node.declarations.length === 1 || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | !inStrictMode && isForStatement || |
| ✓ Was returned | !inStrictMode && isForStatement || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | exceptUndefined && !hasDefinedVariables) { |
| ✓ Was returned | exceptUndefined && !hasDefinedVariables) { |
| Function (anonymous_302) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_303) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_304) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowEmptyBlocks'; }, |
| Function (anonymous_305) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { if (node.body.length === 0 && node.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && node.parentNode.type !== 'FunctionExpression') { errors.add('Empty block found', node.loc.end); } }); } |
| Function (anonymous_306) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· if (node.body.length === 0 && node.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && node.parentNode.type !== 'FunctionExpression') { errors.add('Empty block found', node.loc.end); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.parentNode.type !== 'FunctionExpression') {··· errors.add('Empty block found', node.loc.end); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type !== 'FunctionExpression') { |
| ✓ Was returned | if (node.body.length === 0 &&··· node.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type !== 'FunctionDeclaration' && |
| ✓ Was returned | if (node.body.length === 0 &&··· node.parentNode.type !== 'CatchClause' && |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type !== 'CatchClause' && |
| ✓ Was returned | if (node.body.length === 0 && |
| Function (anonymous_307) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_308) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_309) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceAfterKeywords'; }, |
| Function (anonymous_310) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); if (nextToken.type === 'Punctuator' && nextToken.value === ';') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after "' + token.value + '" keyword' }); }); } |
| Function (anonymous_311) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· var nextToken = file.getNextToken(token, {includeComments: true}); if (nextToken.type === 'Punctuator' && nextToken.value === ';') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after "' + token.value + '" keyword' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'Punctuator' && nextToken.value === ';') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.spacesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === ';') { |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === ';') { |
| Function (anonymous_312) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_313) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_314) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBeforeKeywords'; }, |
| Function (anonymous_315) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } }); } |
| Function (anonymous_316) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!prevToken || prevToken.isComment) {··· return; } |
| ✓ Negative was executed (else) | }··· if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!prevToken || prevToken.isComment) { |
| ✓ Was returned | if (!prevToken || prevToken.isComment) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') {··· errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { |
| ✗ Was not returned | if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { |
| Function (anonymous_317) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_318) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value' ); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_319) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceAfterKeywords'; }, |
| Function (anonymous_320) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token) }); }); } |
| Function (anonymous_321) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token) }); }); |
| Function (anonymous_322) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_323) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_324) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBeforeKeywords'; }, |
| Function (anonymous_325) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } }); } |
| Function (anonymous_326) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!prevToken || prevToken.isComment) {··· return; } |
| ✓ Negative was executed (else) | }··· if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!prevToken || prevToken.isComment) { |
| ✓ Was returned | if (!prevToken || prevToken.isComment) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.type !== 'Keyword' && prevToken.value !== ';') {··· errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { |
| ✓ Was returned | if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { |
| Function (anonymous_327) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_328) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_329) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireParenthesesAroundIIFE'; }, |
| Function (anonymous_330) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· function isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } file.iterateNodesByType('CallExpression', function(node) { var inner = utils.getFunctionNodeFromIIFE(node); if (inner && !isWrapped(inner) && !isWrapped(node)) { errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } }); } |
| Function isWrapped | |
|---|---|
| ✓ Was called | function isWrapped(node) {··· var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var closingTokenValue = closingParensToken ? closingParensToken.value : ''; |
| ✗ Negative was not returned (: ...) | var closingTokenValue = closingParensToken ? closingParensToken.value : ''; |
| Function (anonymous_332) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('CallExpression', function(node) {··· var inner = utils.getFunctionNodeFromIIFE(node); if (inner && !isWrapped(inner) && !isWrapped(node)) { errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (inner && !isWrapped(inner) && !isWrapped(node)) {··· errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (inner && !isWrapped(inner) && !isWrapped(node)) { |
| ✓ Was returned | if (inner && !isWrapped(inner) && !isWrapped(node)) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (inner && !isWrapped(inner) && !isWrapped(node)) { |
| ✓ Was returned | if (inner && !isWrapped(inner) && !isWrapped(node)) { |
| Function (anonymous_333) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_334) | |
|---|---|
| ✓ Was called | configure: function() {}, |
| Function (anonymous_335) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireLeftStickedOperators'; }, |
| Function (anonymous_336) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· errors.add( 'The requireLeftStickedOperators rule is no longer supported.' + '\nPlease use the following rules instead:' + '\n' + '\ndisallowSpaceBeforeBinaryOperators' + '\ndisallowSpaceBeforePostfixUnaryOperators' + '\ndisallowSpacesInConditionalExpression', 1, 0 ); } |
| Function (anonymous_337) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_338) | |
|---|---|
| ✓ Was called | configure: function() {}, |
| Function (anonymous_339) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowLeftStickedOperators'; }, |
| Function (anonymous_340) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· errors.add( 'The disallowLeftStickedOperators rule is no longer supported.' + '\nPlease use the following rules instead:' + '\n' + '\nrequireSpaceBeforeBinaryOperators' + '\nrequireSpaceBeforePostfixUnaryOperators' + '\nrequireSpacesInConditionalExpression', 1, 0 ); } |
| Function (anonymous_341) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_342) | |
|---|---|
| ✓ Was called | configure: function() {}, |
| Function (anonymous_343) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireRightStickedOperators'; }, |
| Function (anonymous_344) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· errors.add( 'The requireRightStickedOperators rule is no longer supported.' + '\nPlease use the following rules instead:' + '\n' + '\ndisallowSpaceAfterBinaryOperators' + '\ndisallowSpaceAfterPrefixUnaryOperators' + '\ndisallowSpacesInConditionalExpression', 1, 0 ); } |
| Function (anonymous_345) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_346) | |
|---|---|
| ✓ Was called | configure: function() {}, |
| Function (anonymous_347) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowRightStickedOperators'; }, |
| Function (anonymous_348) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· errors.add( 'The disallowRightStickedOperators rule is no longer supported.' + '\nPlease use the following rules instead:' + '\n' + '\nrequireSpaceAfterBinaryOperators' + '\nrequireSpaceAfterPrefixUnaryOperators' + '\nrequireSpacesInConditionalExpression', 1, 0 ); } |
| Function (anonymous_349) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_350) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert(typeof options === 'object', this.getOptionName() + ' option requires object value'); this._options = options; }, |
| Function (anonymous_351) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateJSDoc'; }, |
| Function (anonymous_352) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var options = this._options; var comments = file.getComments(); file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { var jsDoc = getJsDocForLine(node.loc.start.line); if (jsDoc) { var jsDocData = jsDoc.value; var jsDocLines = jsDocData.split('\n'); var paramIndex = 0; if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { for (var i = 0, l = jsDocLines.length; i < l; i++) { var line = jsDocLines[i].trim(); if (line.charAt(0) === '*') { line = line.substr(1).trim(); if (line.indexOf('@param') === 0) { var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } } } } }); function getJsDocForLine(line) { line--; for (var i = 0, l = comments.length; i < l; i++) { var comment = comments[i]; if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { return comment; } } return null; } } |
| Function (anonymous_353) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· var jsDoc = getJsDocForLine(node.loc.start.line); if (jsDoc) { var jsDocData = jsDoc.value; var jsDocLines = jsDocData.split('\n'); var paramIndex = 0; if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { for (var i = 0, l = jsDocLines.length; i < l; i++) { var line = jsDocLines[i].trim(); if (line.charAt(0) === '*') { line = line.substr(1).trim(); if (line.indexOf('@param') === 0) { var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } } } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (jsDoc) {··· var jsDocData = jsDoc.value; var jsDocLines = jsDocData.split('\n'); var paramIndex = 0; if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { for (var i = 0, l = jsDocLines.length; i < l; i++) { var line = jsDocLines[i].trim(); if (line.charAt(0) === '*') { line = line.substr(1).trim(); if (line.indexOf('@param') === 0) { var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } } } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) {··· for (var i = 0, l = jsDocLines.length; i < l; i++) { var line = jsDocLines[i].trim(); if (line.charAt(0) === '*') { line = line.substr(1).trim(); if (line.indexOf('@param') === 0) { var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } } } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { |
| ✓ Was returned | if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { |
| ✓ Was returned | if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.charAt(0) === '*') {··· line = line.substr(1).trim(); if (line.indexOf('@param') === 0) { var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.indexOf('@param') === 0) {··· var match = line.match(/^@param\s+(?:{(.+?)})?\s*(?:\[)?([a-zA-Z0-9_\.\$]+)/); if (match) { var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (match) {··· var jsDocParamType = match[1]; var jsDocParamName = match[2]; if (options.requireParamTypes && !jsDocParamType) { errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } if (jsDocParamName.indexOf('.') === -1) { var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } } else { |
| ✓ Negative was executed (else) | } else {··· errors.add( 'Invalid JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.requireParamTypes && !jsDocParamType) {··· errors.add( 'Missing JSDoc @param type', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } |
| ✓ Negative was executed (else) | }··· if (jsDocParamName.indexOf('.') === -1) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (options.requireParamTypes && !jsDocParamType) { |
| ✓ Was returned | if (options.requireParamTypes && !jsDocParamType) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (jsDocParamName.indexOf('.') === -1) {··· var param = node.params[paramIndex]; if (param) { if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } paramIndex++; } |
| ✓ Negative was executed (else) | }··· } else { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (param) {··· if (jsDocParamName !== param.name) { if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } } else { |
| ✓ Negative was executed (else) | } else {··· if (options.checkRedundantParams) { errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (jsDocParamName !== param.name) {··· if (options.checkParamNames) { errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } } |
| ✓ Negative was executed (else) | }··· } else { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.checkParamNames) {··· errors.add( 'Invalid JSDoc @param argument name', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.checkRedundantParams) {··· errors.add( 'Redundant JSDoc @param', jsDoc.loc.start.line + i, jsDocLines[i].indexOf('@param') ); } |
| ✓ Negative was executed (else) | }··· } |
| Function getJsDocForLine | |
|---|---|
| ✓ Was called | function getJsDocForLine(line) {··· line--; for (var i = 0, l = comments.length; i < l; i++) { var comment = comments[i]; if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { return comment; } } return null; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') {··· return comment; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { |
| ✓ Was returned | if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { |
| ✓ Was returned | if (comment.loc.end.line === line && comment.type === 'Block' && comment.value.charAt(0) === '*') { |
| Function (anonymous_355) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_356) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array value or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_357) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireOperatorBeforeLineBreak'; }, |
| Function (anonymous_358) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; var throughTokens = ['?', ',']; function errorIfApplicable(operatorToken) { errors.assert.sameLine({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + operatorToken.value + ' should not be on a new line', stickToPreviousToken: true }); } throughTokens = throughTokens.filter(function(operator) { return operators[operator]; }); if (throughTokens.length) { file.iterateTokensByType('Punctuator', function(token) { var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); } file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'LogicalExpression'], function(node) { var operator = node.operator; if (!operators[operator]) { return; } var nextToken = file.getFirstNodeToken(node.argument || node.right); var token = file.findPrevOperatorToken(nextToken, operator); errorIfApplicable(token); } ); } |
| Function errorIfApplicable | |
|---|---|
| ✓ Was called | function errorIfApplicable(operatorToken) {··· errors.assert.sameLine({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + operatorToken.value + ' should not be on a new line', stickToPreviousToken: true }); } |
| Function (anonymous_360) | |
|---|---|
| ✓ Was called | throughTokens = throughTokens.filter(function(operator) {··· return operators[operator]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (throughTokens.length) {··· file.iterateTokensByType('Punctuator', function(token) { var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); } |
| ✓ Negative was executed (else) | }··· file.iterateNodesByType( |
| Function (anonymous_361) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Punctuator', function(token) {··· var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); |
| Function (anonymous_362) | |
|---|---|
| ✓ Was called | if (throughTokens.every(function() {··· return throughTokens.indexOf(operator) >= 0; })) { |
| Branch IfStatement | |
| ✓ Positive was executed (if) | })) {··· errorIfApplicable(token); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_363) | |
|---|---|
| ✓ Was called | function(node) {··· var operator = node.operator; if (!operators[operator]) { return; } var nextToken = file.getFirstNodeToken(node.argument || node.right); var token = file.findPrevOperatorToken(nextToken, operator); errorIfApplicable(token); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!operators[operator]) {··· return; } |
| ✓ Negative was executed (else) | }··· var nextToken = file.getFirstNodeToken(node.argument || node.right); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var nextToken = file.getFirstNodeToken(node.argument || node.right); |
| ✗ Was not returned | var nextToken = file.getFirstNodeToken(node.argument || node.right); |
| Function (anonymous_364) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_365) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· assert(Array.isArray(operators) || operators === true, this.getOptionName() + ' option requires array or true value'); if (operators === true) { operators = defaultOperators; } this._operators = operators; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(Array.isArray(operators) || operators === true, |
| ✓ Was returned | assert(Array.isArray(operators) || operators === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators === true) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operators = operators; |
| Function (anonymous_366) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowOperatorBeforeLineBreak'; }, |
| Function (anonymous_367) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Punctuator', this._operators, function(token) { errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Operator needs to either be on the same line or after a line break.' }); }); } |
| Function (anonymous_368) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', this._operators, function(token) {··· errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Operator needs to either be on the same line or after a line break.' }); }); |
| Function (anonymous_369) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_370) | |
|---|---|
| ✓ Was called | configure: function(types) {··· assert(Array.isArray(types), this.getOptionName() + ' option requires array value'); this._typeIndex = {}; for (var i = 0, l = types.length; i < l; i++) { this._typeIndex[types[i]] = true; } }, |
| Function (anonymous_371) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowImplicitTypeConversion'; }, |
| Function (anonymous_372) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var types = this._typeIndex; if (types.numeric || types.boolean || types.binary) { file.iterateNodesByType('UnaryExpression', function(node) { if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); } if (types.string) { file.iterateNodesByType('BinaryExpression', function(node) { if (node.operator === '+' && ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) ) { errors.add('Implicit string conversion', node.loc.start); } }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (types.numeric || types.boolean || types.binary) {··· file.iterateNodesByType('UnaryExpression', function(node) { if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); } |
| ✓ Negative was executed (else) | }··· if (types.string) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (types.numeric || types.boolean || types.binary) { |
| ✓ Was returned | if (types.numeric || types.boolean || types.binary) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (types.numeric || types.boolean || types.binary) { |
| ✓ Was returned | if (types.numeric || types.boolean || types.binary) { |
| Function (anonymous_373) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('UnaryExpression', function(node) {··· if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (types.numeric && node.operator === '+') {··· errors.add('Implicit numeric conversion', node.loc.start); } |
| ✓ Negative was executed (else) | }··· if (types.binary && node.operator === '~') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (types.numeric && node.operator === '+') { |
| ✓ Was returned | if (types.numeric && node.operator === '+') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (types.binary && node.operator === '~') {··· errors.add('Implicit binary conversion', node.loc.start); } |
| ✓ Negative was executed (else) | }··· if (types.boolean && |
| Branch LogicalExpression | |
| ✓ Was returned | if (types.binary && node.operator === '~') { |
| ✓ Was returned | if (types.binary && node.operator === '~') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add('Implicit boolean conversion', node.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | node.argument.operator === '!' |
| ✓ Was returned | if (types.boolean &&··· node.operator === '!' && node.argument.type === 'UnaryExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | node.argument.type === 'UnaryExpression' && |
| ✓ Was returned | if (types.boolean &&··· node.operator === '!' && |
| Branch LogicalExpression | |
| ✓ Was returned | node.operator === '!' && |
| ✓ Was returned | if (types.boolean && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (types.string) {··· file.iterateNodesByType('BinaryExpression', function(node) { if (node.operator === '+' && ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) ) { errors.add('Implicit string conversion', node.loc.start); } }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_374) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BinaryExpression', function(node) {··· if (node.operator === '+' && ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) ) { errors.add('Implicit string conversion', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add('Implicit string conversion', node.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | (node.left.type === 'Literal' && node.left.value === '') ||··· (node.right.type === 'Literal' && node.right.value === '') |
| ✓ Was returned | if (node.operator === '+' && ( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.right.type === 'Literal' && node.right.value === '') |
| ✓ Was returned | (node.left.type === 'Literal' && node.left.value === '') || |
| Branch LogicalExpression | |
| ✓ Was returned | (node.left.type === 'Literal' && node.left.value === '') || |
| ✓ Was returned | (node.left.type === 'Literal' && node.left.value === '') || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.right.type === 'Literal' && node.right.value === '') |
| ✓ Was returned | (node.right.type === 'Literal' && node.right.value === '') |
| Function (anonymous_375) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_376) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'ignoreProperties', this.getOptionName() + ' option requires a true value or `ignoreProperties`' ); this._ignoreProperties = (options === 'ignoreProperties'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'ignoreProperties', |
| ✓ Was returned | options === true || options === 'ignoreProperties', |
| Function (anonymous_377) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireCamelCaseOrUpperCaseIdentifiers'; }, |
| Function (anonymous_378) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByType('Identifier', function(token) { var value = token.value; if (value.replace(/^_+|_+$/g, '').indexOf('_') === -1 || value.toUpperCase() === value) { return; } if (this._ignoreProperties) { var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } errors.add( 'All identifiers must be camelCase or UPPER_CASE', token.loc.start.line, token.loc.start.column ); }.bind(this)); } |
| Function (anonymous_379) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Identifier', function(token) {··· var value = token.value; if (value.replace(/^_+|_+$/g, '').indexOf('_') === -1 || value.toUpperCase() === value) { return; } if (this._ignoreProperties) { var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } errors.add( 'All identifiers must be camelCase or UPPER_CASE', token.loc.start.line, token.loc.start.column ); }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value.replace(/^_+|_+$/g, '').indexOf('_') === -1 || value.toUpperCase() === value) {··· return; } |
| ✓ Negative was executed (else) | }··· if (this._ignoreProperties) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (value.replace(/^_+|_+$/g, '').indexOf('_') === -1 || value.toUpperCase() === value) { |
| ✓ Was returned | if (value.replace(/^_+|_+$/g, '').indexOf('_') === -1 || value.toUpperCase() === value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._ignoreProperties) {··· var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } |
| ✓ Negative was executed (else) | }··· errors.add( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken && nextToken.value === ':') {··· return; } |
| ✓ Negative was executed (else) | }··· if (prevToken && (prevToken.value === '.' || |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken && nextToken.value === ':') { |
| ✗ Was not returned | if (nextToken && nextToken.value === ':') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | prevToken.value === 'get' || prevToken.value === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken && (prevToken.value === '.' ||··· prevToken.value === 'get' || prevToken.value === 'set')) { |
| ✓ Was returned | if (prevToken && (prevToken.value === '.' || |
| Branch LogicalExpression | |
| ✓ Was returned | prevToken.value === 'get' || prevToken.value === 'set')) { |
| ✓ Was returned | if (prevToken && (prevToken.value === '.' ||··· prevToken.value === 'get' || prevToken.value === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | prevToken.value === 'get' || prevToken.value === 'set')) { |
| ✓ Was returned | if (prevToken && (prevToken.value === '.' || |
| Function (anonymous_380) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_381) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_382) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowKeywords'; }, |
| Function (anonymous_383) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.add( 'Illegal keyword: ' + token.value, token.loc.start ); }); } |
| Function (anonymous_384) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· errors.add( 'Illegal keyword: ' + token.value, token.loc.start ); }); |
| Function (anonymous_385) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_386) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_387) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowMultipleLineBreaks'; }, |
| Function (anonymous_388) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· // Iterate over all tokens (including comments) file.getTokens().forEach(function(token, index, tokens) { // If there are no trailing tokens, exit early var nextToken = tokens[index + 1]; if (!nextToken) { return; } errors.assert.linesBetween({ token: token, nextToken: nextToken, atMost: 2, }); }); } |
| Function (anonymous_389) | |
|---|---|
| ✓ Was called | file.getTokens().forEach(function(token, index, tokens) {··· // If there are no trailing tokens, exit early var nextToken = tokens[index + 1]; if (!nextToken) { return; } errors.assert.linesBetween({ token: token, nextToken: nextToken, atMost: 2, }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!nextToken) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Function (anonymous_390) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_391) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_392) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowMultipleLineStrings'; }, |
| Function (anonymous_393) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByType('String', function(token) { if (token.loc.start.line !== token.loc.end.line) { errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } }); } |
| Function (anonymous_394) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('String', function(token) {··· if (token.loc.start.line !== token.loc.end.line) { errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.loc.start.line !== token.loc.end.line) {··· errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_395) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_396) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || typeof options === 'object' && options.allowEOLComments === true, this.getOptionName() + ' option requires true value ' + 'or an object with `allowEOLComments` property' ); this.allowEOLComments = options.allowEOLComments; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'object' &&··· options.allowEOLComments === true, |
| ✓ Was returned | options === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.allowEOLComments === true, |
| ✓ Was returned | typeof options === 'object' && |
| Function (anonymous_397) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowMultipleSpaces'; }, |
| Function (anonymous_398) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· // Iterate over all tokens (including comments) var _this = this; file.getTokens().forEach(function(token, index, tokens) { // If there are no trailing tokens, exit early var nextToken = tokens[index + 1]; if (!nextToken) { return; } // If we are allowing EOL comments and the next token is an EOL comment skip it // We don't need to check the current token since EOL comments must be on separate lines from the next one if (_this.allowEOLComments && nextToken.type === 'Line') { return; } // Verify we have at most 1 space between this token and the next (won't fail for different lines) errors.assert.spacesBetween({ token: token, nextToken: nextToken, atMost: 1, }); }); } |
| Function (anonymous_399) | |
|---|---|
| ✓ Was called | file.getTokens().forEach(function(token, index, tokens) {··· // If there are no trailing tokens, exit early var nextToken = tokens[index + 1]; if (!nextToken) { return; } // If we are allowing EOL comments and the next token is an EOL comment skip it // We don't need to check the current token since EOL comments must be on separate lines from the next one if (_this.allowEOLComments && nextToken.type === 'Line') { return; } // Verify we have at most 1 space between this token and the next (won't fail for different lines) errors.assert.spacesBetween({ token: token, nextToken: nextToken, atMost: 1, }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!nextToken) {··· return; } |
| ✓ Negative was executed (else) | }··· // If we are allowing EOL comments and the next token is an EOL comment skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this.allowEOLComments && nextToken.type === 'Line') {··· return; } |
| ✓ Negative was executed (else) | }··· // Verify we have at most 1 space between this token and the next (won't fail for different lines) |
| Branch LogicalExpression | |
| ✓ Was returned | if (_this.allowEOLComments && nextToken.type === 'Line') { |
| ✓ Was returned | if (_this.allowEOLComments && nextToken.type === 'Line') { |
| Function (anonymous_400) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_401) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'string' || typeof options === 'object', this.getOptionName() + ' option requires string or object value' ); if (typeof options === 'string') { options = { character: options }; } var lineBreaks = { CR: '\r', LF: '\n', CRLF: '\r\n' }; this._allowedLineBreak = lineBreaks[options.character]; this._reportOncePerFile = options.reportOncePerFile !== false; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'string' || typeof options === 'object', |
| ✓ Was returned | typeof options === 'string' || typeof options === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof options === 'string') {··· options = { character: options }; } |
| ✓ Negative was executed (else) | }··· var lineBreaks = { |
| Function (anonymous_402) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateLineBreaks'; }, |
| Function (anonymous_403) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var lines = file.getLines(); if (lines.length < 2) { return; } file.getLineBreaks().some(function(lineBreak, i) { if (lineBreak !== this._allowedLineBreak) { errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } }, this); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lines.length < 2) {··· return; } |
| ✓ Negative was executed (else) | }··· file.getLineBreaks().some(function(lineBreak, i) { |
| Function (anonymous_404) | |
|---|---|
| ✓ Was called | file.getLineBreaks().some(function(lineBreak, i) {··· if (lineBreak !== this._allowedLineBreak) { errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lineBreak !== this._allowedLineBreak) {··· errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } |
| ✓ Negative was executed (else) | }··· }, this); |
| Function (anonymous_405) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_406) | |
|---|---|
| ✓ Was called | configure: function(quoteMark) {··· this._allowEscape = false; if (typeof quoteMark === 'object') { assert( typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, this.getOptionName() + ' option requires the "escape" and "mark" property to be defined' ); this._allowEscape = quoteMark.escape; quoteMark = quoteMark.mark; } assert( quoteMark === '"' || quoteMark === '\'' || quoteMark === true, this.getOptionName() + ' option requires \'"\', "\'", or boolean true' ); this._quoteMark = quoteMark; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof quoteMark === 'object') {··· assert( typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, this.getOptionName() + ' option requires the "escape" and "mark" property to be defined' ); this._allowEscape = quoteMark.escape; quoteMark = quoteMark.mark; } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, |
| ✓ Was returned | typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | quoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| ✓ Was returned | quoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Branch LogicalExpression | |
| ✓ Was returned | quoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| ✓ Was returned | quoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Function (anonymous_407) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateQuoteMarks'; }, |
| Function (anonymous_408) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var quoteMark = this._quoteMark; var allowEscape = this._allowEscape; var opposite = { '"': '\'', '\'': '"' }; file.iterateTokensByType('String', function(token) { var str = token.value; var mark = str[0]; var stripped = str.substring(1, str.length - 1); if (quoteMark === true) { quoteMark = mark; } if (mark !== quoteMark) { if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.add( 'Invalid quote mark found', token.loc.start.line, token.loc.start.column ); } }); } |
| Function (anonymous_409) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('String', function(token) {··· var str = token.value; var mark = str[0]; var stripped = str.substring(1, str.length - 1); if (quoteMark === true) { quoteMark = mark; } if (mark !== quoteMark) { if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.add( 'Invalid quote mark found', token.loc.start.line, token.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (quoteMark === true) {··· quoteMark = mark; } |
| ✓ Negative was executed (else) | }··· if (mark !== quoteMark) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mark !== quoteMark) {··· if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.add( 'Invalid quote mark found', token.loc.start.line, token.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (allowEscape && stripped.indexOf(opposite[mark]) > -1) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.add( |
| Branch LogicalExpression | |
| ✓ Was returned | if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { |
| ✓ Was returned | if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { |
| Function (anonymous_410) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_411) | |
|---|---|
| ✓ Was called | configure: function(options) {··· this._includeEmptyLines = false; if (typeof options === 'object') { this._includeEmptyLines = (options.includeEmptyLines === true); options = options.value; } assert( options === '\t' || (typeof options === 'number' && options > 0), this.getOptionName() + ' option requires a positive number of spaces or "\\t"' + ' or options object with "value" property' ); if (typeof options === 'number') { this._indentChar = ' '; this._indentSize = options; } else { this._indentChar = '\t'; this._indentSize = 1; } this._breakIndents = null; this._moduleIndents = null; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof options === 'object') {··· this._includeEmptyLines = (options.includeEmptyLines === true); options = options.value; } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (typeof options === 'number' && options > 0), |
| ✓ Was returned | options === '\t' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (typeof options === 'number' && options > 0), |
| ✓ Was returned | (typeof options === 'number' && options > 0), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof options === 'number') {··· this._indentChar = ' '; this._indentSize = options; } else { |
| ✓ Negative was executed (else) | } else {··· this._indentChar = '\t'; this._indentSize = 1; } |
| Function (anonymous_412) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateIndentation'; }, |
| Function (anonymous_413) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· function markCheckLine(line) { linesToCheck[line].check = true; } function markCheck(node) { markCheckLine(node.loc.start.line - 1); } function markEndCheck(node) { markCheckLine(node.loc.end.line - 1); } function markPush(node, indents) { linesToCheck[node.loc.start.line - 1].push.push(indents); } function markPop(node, outdents) { linesToCheck[node.loc.end.line - 1].pop.push(outdents); } function markPushAlt(node) { linesToCheck[node.loc.start.line - 1].pushAltLine.push(node.loc.end.line - 1); } function markCase(caseNode, children) { var outdentNode = getCaseOutdent(children); if (outdentNode) { // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { markPop(caseNode, 0); } } function markChildren(node) { getChildren(node).forEach(function(childNode) { if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); } function markKeyword(node) { if (node) { markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } } function isMultiline(node) { return node.loc.start.line !== node.loc.end.line; } function getCaseOutdent(caseChildren) { var outdentNode; caseChildren.some(function(node) { if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); return outdentNode; } function getBlockNodeToPush(node) { var parent = node.parentNode; // The parent of an else is the entire if/else block. To avoid over indenting // in the case of a non-block if with a block else, mark push where the else starts, // not where the if starts! if (parent.type === 'IfStatement' && parent.alternate === node) { return node; } // The end line to check of a do while statement needs to be the location of the // closing curly brace, not the while statement, to avoid marking the last line of // a multiline while as a line to check. if (parent.type === 'DoWhileStatement') { return node; } // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. if (blockParents.indexOf(parent.type) === -1) { return node; } return parent; } function getChildren(node) { var childrenProperty = indentableNodes[node.type]; return node[childrenProperty]; } function getIndentationFromLine(line) { var rNotIndentChar = new RegExp('[^' + indentChar + ']'); var firstContent = line.search(rNotIndentChar); if (firstContent === -1) { firstContent = line.length; } return firstContent; } function checkIndentations() { var lineAugment = 0; linesToCheck.forEach(function(line, i) { var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); } function getExpectedIndentation(line, actual) { var outdent = indentSize * Math.max.apply(null, line.pop); var idx = indentStack.length - 1; var expected = indentStack[idx]; if (!Array.isArray(expected)) { expected = [expected]; } expected = expected.map(function(value) { if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); indentStack[idx] = expected; line.pop.forEach(function() { indentStack.pop(); }); return expected; } function pushExpectedIndentations(line, actualIndentation) { var indents = Math.max.apply(null, line.push); var expected = actualIndentation + (indentSize * indents); // when a line has alternate indentations, push an array of possible values // on the stack, to be resolved when checked against an actual indentation if (line.pushAltLine.length) { expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } line.push.forEach(function() { indentStack.push(expected); }); } function setModuleBody(node) { if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || node.body[0].expression.type !== 'CallExpression') { return; } var callExpression = node.body[0].expression; var callee = callExpression.callee; var callArgs = callExpression.arguments; var iffeFunction = utils.getFunctionNodeFromIIFE(callExpression); if (iffeFunction) { if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } // detect require/define if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } // set number of indents for modules by detecting // whether the first statement is indented or not if (moduleBody && moduleBody.body.length) { _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } } function generateIndentations() { file.iterateNodesByType('Program', function(node) { if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); file.iterateNodesByType('BlockStatement', function(node) { if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); file.iterateNodesByType('ObjectExpression', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); file.iterateNodesByType('IfStatement', function(node) { markKeyword(node.alternate); }); file.iterateNodesByType('TryStatement', function(node) { if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); file.iterateNodesByType('SwitchStatement', function(node) { if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); file.iterateNodesByType('SwitchCase', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); // indentations inside of function expressions can be offset from // either the start of the function or the end of the function, therefore // mark all starting lines of functions as potential indentations file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { markPushAlt(node); }); if (_this._includeEmptyLines) { linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } // starting from the bottom, which allows back to back comments to be checked, mark comments file.getComments().concat().reverse().forEach(function(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, {includeComments: true}); var nextToken = file.getNextToken(firstToken, {includeComments: true}); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); } var _this = this; var moduleBody; var indentChar = this._indentChar; var indentSize = this._indentSize; var indentStack = [0]; var linesToCheck = file.getLines().map(function(line) { return { push: [], pushAltLine: [], pop: [], check: false, indentation: getIndentationFromLine(line), empty: line.match(/^\s*$/) }; }); generateIndentations(); checkIndentations(); } |
| Function markCheckLine | |
|---|---|
| ✓ Was called | function markCheckLine(line) {··· linesToCheck[line].check = true; } |
| Function markCheck | |
|---|---|
| ✓ Was called | function markCheck(node) {··· markCheckLine(node.loc.start.line - 1); } |
| Function markEndCheck | |
|---|---|
| ✓ Was called | function markEndCheck(node) {··· markCheckLine(node.loc.end.line - 1); } |
| Function markPush | |
|---|---|
| ✓ Was called | function markPush(node, indents) {··· linesToCheck[node.loc.start.line - 1].push.push(indents); } |
| Function markPop | |
|---|---|
| ✓ Was called | function markPop(node, outdents) {··· linesToCheck[node.loc.end.line - 1].pop.push(outdents); } |
| Function markPushAlt | |
|---|---|
| ✓ Was called | function markPushAlt(node) {··· linesToCheck[node.loc.start.line - 1].pushAltLine.push(node.loc.end.line - 1); } |
| Function markCase | |
|---|---|
| ✓ Was called | function markCase(caseNode, children) {··· var outdentNode = getCaseOutdent(children); if (outdentNode) { // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { markPop(caseNode, 0); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (outdentNode) {··· // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { |
| ✓ Negative was executed (else) | } else {··· markPop(caseNode, 0); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this._breakIndents === null) {··· _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } |
| ✓ Negative was executed (else) | }··· markPop(outdentNode, _this._breakIndents); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; |
| ✓ Negative was returned (: ...) | _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; |
| Function markChildren | |
|---|---|
| ✓ Was called | function markChildren(node) {··· getChildren(node).forEach(function(childNode) { if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); } |
| Function (anonymous_422) | |
|---|---|
| ✓ Was called | getChildren(node).forEach(function(childNode) {··· if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (childNode.loc.start.line !== node.loc.start.line) {··· markCheck(childNode); } |
| ✓ Negative was executed (else) | }··· }); |
| Function markKeyword | |
|---|---|
| ✓ Was called | function markKeyword(node) {··· if (node) { markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node) {··· markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } |
| ✓ Negative was executed (else) | }··· } |
| Function isMultiline | |
|---|---|
| ✓ Was called | function isMultiline(node) {··· return node.loc.start.line !== node.loc.end.line; } |
| Function getCaseOutdent | |
|---|---|
| ✓ Was called | function getCaseOutdent(caseChildren) {··· var outdentNode; caseChildren.some(function(node) { if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); return outdentNode; } |
| Function (anonymous_426) | |
|---|---|
| ✓ Was called | caseChildren.some(function(node) {··· if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'BreakStatement') {··· outdentNode = node; return true; } |
| ✓ Negative was executed (else) | }··· }); |
| Function getBlockNodeToPush | |
|---|---|
| ✓ Was called | function getBlockNodeToPush(node) {··· var parent = node.parentNode; // The parent of an else is the entire if/else block. To avoid over indenting // in the case of a non-block if with a block else, mark push where the else starts, // not where the if starts! if (parent.type === 'IfStatement' && parent.alternate === node) { return node; } // The end line to check of a do while statement needs to be the location of the // closing curly brace, not the while statement, to avoid marking the last line of // a multiline while as a line to check. if (parent.type === 'DoWhileStatement') { return node; } // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. if (blockParents.indexOf(parent.type) === -1) { return node; } return parent; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'IfStatement' && parent.alternate === node) {··· return node; } |
| ✓ Negative was executed (else) | }··· // The end line to check of a do while statement needs to be the location of the |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'IfStatement' && parent.alternate === node) { |
| ✓ Was returned | if (parent.type === 'IfStatement' && parent.alternate === node) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'DoWhileStatement') {··· return node; } |
| ✓ Negative was executed (else) | }··· // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (blockParents.indexOf(parent.type) === -1) {··· return node; } |
| ✓ Negative was executed (else) | }··· return parent; |
| Function getChildren | |
|---|---|
| ✓ Was called | function getChildren(node) {··· var childrenProperty = indentableNodes[node.type]; return node[childrenProperty]; } |
| Function getIndentationFromLine | |
|---|---|
| ✓ Was called | function getIndentationFromLine(line) {··· var rNotIndentChar = new RegExp('[^' + indentChar + ']'); var firstContent = line.search(rNotIndentChar); if (firstContent === -1) { firstContent = line.length; } return firstContent; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (firstContent === -1) {··· firstContent = line.length; } |
| ✓ Negative was executed (else) | }··· return firstContent; |
| Function checkIndentations | |
|---|---|
| ✓ Was called | function checkIndentations() {··· var lineAugment = 0; linesToCheck.forEach(function(line, i) { var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); } |
| Function (anonymous_431) | |
|---|---|
| ✓ Was called | linesToCheck.forEach(function(line, i) {··· var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.pop.length || line.push.length) {··· lineAugment = 0; } |
| ✓ Negative was executed (else) | }··· if (line.check) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (line.pop.length || line.push.length) { |
| ✓ Was returned | if (line.pop.length || line.push.length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.check) {··· errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { |
| ✓ Negative was executed (else) | } else if (!line.empty) {··· // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (!line.empty) {··· // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } |
| ✓ Negative was executed (else) | }··· if (line.push.length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.push.length) {··· pushExpectedIndentations(line, actualIndentation); } |
| ✓ Negative was executed (else) | }··· }); |
| Function getExpectedIndentation | |
|---|---|
| ✓ Was called | function getExpectedIndentation(line, actual) {··· var outdent = indentSize * Math.max.apply(null, line.pop); var idx = indentStack.length - 1; var expected = indentStack[idx]; if (!Array.isArray(expected)) { expected = [expected]; } expected = expected.map(function(value) { if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); indentStack[idx] = expected; line.pop.forEach(function() { indentStack.pop(); }); return expected; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!Array.isArray(expected)) {··· expected = [expected]; } |
| ✓ Negative was executed (else) | }··· expected = expected.map(function(value) { |
| Function (anonymous_433) | |
|---|---|
| ✓ Was called | expected = expected.map(function(value) {··· if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.pop.length) {··· value -= outdent; } |
| ✓ Negative was executed (else) | }··· return value; |
| Function (anonymous_434) | |
|---|---|
| ✓ Was called | }).reduce(function(previous, current) {··· // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return actual === current ? current : previous; |
| ✓ Negative was returned (: ...) | return actual === current ? current : previous; |
| Function (anonymous_435) | |
|---|---|
| ✓ Was called | line.pop.forEach(function() {··· indentStack.pop(); }); |
| Function pushExpectedIndentations | |
|---|---|
| ✓ Was called | function pushExpectedIndentations(line, actualIndentation) {··· var indents = Math.max.apply(null, line.push); var expected = actualIndentation + (indentSize * indents); // when a line has alternate indentations, push an array of possible values // on the stack, to be resolved when checked against an actual indentation if (line.pushAltLine.length) { expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } line.push.forEach(function() { indentStack.push(expected); }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.pushAltLine.length) {··· expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } |
| ✓ Negative was executed (else) | }··· line.push.forEach(function() { |
| Function (anonymous_437) | |
|---|---|
| ✓ Was called | line.pushAltLine.forEach(function(altLine) {··· expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); |
| Function (anonymous_438) | |
|---|---|
| ✓ Was called | line.push.forEach(function() {··· indentStack.push(expected); }); |
| Function setModuleBody | |
|---|---|
| ✓ Was called | function setModuleBody(node) {··· if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || node.body[0].expression.type !== 'CallExpression') { return; } var callExpression = node.body[0].expression; var callee = callExpression.callee; var callArgs = callExpression.arguments; var iffeFunction = utils.getFunctionNodeFromIIFE(callExpression); if (iffeFunction) { if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } // detect require/define if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } // set number of indents for modules by detecting // whether the first statement is indented or not if (moduleBody && moduleBody.body.length) { _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.body[0].expression.type !== 'CallExpression') {··· return; } |
| ✓ Negative was executed (else) | }··· var callExpression = node.body[0].expression; |
| Branch LogicalExpression | |
| ✓ Was returned | node.body[0].expression.type !== 'CallExpression') { |
| ✓ Was returned | if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || |
| ✓ Was returned | if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (iffeFunction) {··· if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } |
| ✓ Negative was executed (else) | }··· // detect require/define |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') {··· // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { |
| ✓ Negative was executed (else) | } else {··· // full file IIFE moduleBody = iffeFunction.body; } |
| Branch LogicalExpression | |
| ✓ Was returned | if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { |
| ✗ Was not returned | if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) {··· // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } |
| ✓ Negative was executed (else) | }··· // set number of indents for modules by detecting |
| Branch LogicalExpression | |
| ✓ Was returned | if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { |
| ✓ Was returned | if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { |
| Function (anonymous_440) | |
|---|---|
| ✓ Was called | callArgs.some(function(argument) {··· if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (argument.type === 'FunctionExpression') {··· moduleBody = argument.body; return true; } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (moduleBody && moduleBody.body.length) {··· _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (moduleBody && moduleBody.body.length) { |
| ✓ Was returned | if (moduleBody && moduleBody.body.length) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; |
| ✓ Negative was returned (: ...) | _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; |
| Function generateIndentations | |
|---|---|
| ✓ Was called | function generateIndentations() {··· file.iterateNodesByType('Program', function(node) { if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); file.iterateNodesByType('BlockStatement', function(node) { if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); file.iterateNodesByType('ObjectExpression', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); file.iterateNodesByType('IfStatement', function(node) { markKeyword(node.alternate); }); file.iterateNodesByType('TryStatement', function(node) { if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); file.iterateNodesByType('SwitchStatement', function(node) { if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); file.iterateNodesByType('SwitchCase', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); // indentations inside of function expressions can be offset from // either the start of the function or the end of the function, therefore // mark all starting lines of functions as potential indentations file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { markPushAlt(node); }); if (_this._includeEmptyLines) { linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } // starting from the bottom, which allows back to back comments to be checked, mark comments file.getComments().concat().reverse().forEach(function(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, {includeComments: true}); var nextToken = file.getNextToken(firstToken, {includeComments: true}); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); } |
| Function (anonymous_442) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('Program', function(node) {··· if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· setModuleBody(node); |
| Function (anonymous_443) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· var indents = node === moduleBody ? _this._moduleIndents : 1; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var indents = node === moduleBody ? _this._moduleIndents : 1; |
| ✓ Negative was returned (: ...) | var indents = node === moduleBody ? _this._moduleIndents : 1; |
| Function (anonymous_444) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· var children = getChildren(node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.loc.end.line === children[children.length - 1].loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· markChildren(node); |
| Branch LogicalExpression | |
| ✓ Was returned | node.loc.end.line === children[children.length - 1].loc.end.line) { |
| ✓ Was returned | if (!children.length || node.loc.start.line === children[0].loc.start.line || |
| Branch LogicalExpression | |
| ✓ Was returned | if (!children.length || node.loc.start.line === children[0].loc.start.line || |
| ✗ Was not returned | if (!children.length || node.loc.start.line === children[0].loc.start.line || |
| Function (anonymous_445) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('IfStatement', function(node) {··· markKeyword(node.alternate); }); |
| Function (anonymous_446) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('TryStatement', function(node) {··· if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| ✓ Negative was returned (: ...) | var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| Branch LogicalExpression | |
| ✓ Was returned | var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| ✗ Was not returned | var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (handler) {··· markCheck(handler); } |
| ✓ Negative was executed (else) | }··· markKeyword(node.finalizer); |
| Function (anonymous_447) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('SwitchStatement', function(node) {··· if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· var indents = 1; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.loc.start.column === children[0].loc.start.column) {··· indents = 0; } |
| ✓ Negative was executed (else) | }··· markChildren(node); |
| Function (anonymous_448) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('SwitchCase', function(node) {··· if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isMultiline(node)) {··· return; } |
| ✓ Negative was executed (else) | }··· var children = getChildren(node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (children.length === 1 && children[0].type === 'BlockStatement') {··· return; } |
| ✓ Negative was executed (else) | }··· markPush(node, 1); |
| Branch LogicalExpression | |
| ✓ Was returned | if (children.length === 1 && children[0].type === 'BlockStatement') { |
| ✓ Was returned | if (children.length === 1 && children[0].type === 'BlockStatement') { |
| Function (anonymous_449) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· markPushAlt(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this._includeEmptyLines) {··· linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } |
| ✓ Negative was executed (else) | }··· // starting from the bottom, which allows back to back comments to be checked, mark comments |
| Function (anonymous_450) | |
|---|---|
| ✓ Was called | linesToCheck.forEach(function(line) {··· if (line.empty) { line.check = true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.empty) {··· line.check = true; } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_451) | |
|---|---|
| ✓ Was called | file.getComments().concat().reverse().forEach(function(node) {··· var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, {includeComments: true}); var nextToken = file.getNextToken(firstToken, {includeComments: true}); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (firstToken !== node || startLine === nextStartLine || !nextLine.check) {··· return; } |
| ✓ Negative was executed (else) | }··· // ignore if next line is a case statement, which is kind of hacky, but avoids |
| Branch LogicalExpression | |
| ✓ Was returned | if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| ✓ Was returned | if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| ✓ Was returned | if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | (nextToken.value === 'case' || nextToken.value === 'default')) {··· return; } |
| ✓ Negative was executed (else) | }··· // ignore if above a line that both introduces and ends an ident, |
| Branch LogicalExpression | |
| ✓ Was returned | (nextToken.value === 'case' || nextToken.value === 'default')) { |
| ✓ Was returned | if (nextToken && nextToken.type === 'Keyword' && |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken && nextToken.type === 'Keyword' && |
| ✗ Was not returned | if (nextToken && nextToken.type === 'Keyword' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (nextToken.value === 'case' || nextToken.value === 'default')) { |
| ✓ Was returned | (nextToken.value === 'case' || nextToken.value === 'default')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextLine.push.length && nextLine.pop.length) {··· return; } |
| ✓ Negative was executed (else) | }··· markCheck(node); |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextLine.push.length && nextLine.pop.length) { |
| ✓ Was returned | if (nextLine.push.length && nextLine.pop.length) { |
| Function (anonymous_452) | |
|---|---|
| ✓ Was called | var linesToCheck = file.getLines().map(function(line) {··· return { push: [], pushAltLine: [], pop: [], check: false, indentation: getIndentationFromLine(line), empty: line.match(/^\s*$/) }; }); |
| Function (anonymous_453) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_454) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'ignoreEmptyLines', this.getOptionName() + ' option requires a true value or "ignoreEmptyLines"' ); this._ignoreEmptyLines = options === 'ignoreEmptyLines'; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'ignoreEmptyLines', |
| ✓ Was returned | options === true || options === 'ignoreEmptyLines', |
| Function (anonymous_455) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowTrailingWhitespace'; }, |
| Function (anonymous_456) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var ignoreEmptyLines = this._ignoreEmptyLines; var lines = file.getLines(); for (var i = 0, l = lines.length; i < l; i++) { if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { errors.add('Illegal trailing whitespace', i + 1, lines[i].length); } } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) {··· errors.add('Illegal trailing whitespace', i + 1, lines[i].length); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| ✓ Was returned | if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| ✓ Was returned | if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| Function (anonymous_457) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_458) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'smart', this.getOptionName() + ' option requires a true value or "smart"' ); this._options = options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'smart', |
| ✓ Was returned | options === true || options === 'smart', |
| Function (anonymous_459) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowMixedSpacesAndTabs'; }, |
| Function (anonymous_460) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var test = this._options === true ? (/ \t|\t [^\*]|\t $/) : (/ \t/); file.getLinesWithCommentsRemoved().forEach(function(line, i) { if (line.match(test)) { errors.add('Mixed spaces and tabs found', i + 1, 0); } }); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | (/ \t|\t [^\*]|\t $/) : |
| ✓ Negative was returned (: ...) | (/ \t/); |
| Function (anonymous_461) | |
|---|---|
| ✓ Was called | file.getLinesWithCommentsRemoved().forEach(function(line, i) {··· if (line.match(test)) { errors.add('Mixed spaces and tabs found', i + 1, 0); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.match(test)) {··· errors.add('Mixed spaces and tabs found', i + 1, 0); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_462) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_463) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_464) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireKeywordsOnNewLine'; }, |
| Function (anonymous_465) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token }); }); } |
| Function (anonymous_466) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token }); }); |
| Function (anonymous_467) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_468) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_469) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowKeywordsOnNewLine'; }, |
| Function (anonymous_470) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token); // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. if (token.value === 'else' && prevToken.value !== '}') { return; } // Special cases for #885, using while as the keyword contradicts rule meaning // but it is more efficient and reduces complexity of the code in this rule if (token.value === 'while') { var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } errors.assert.sameLine({ token: prevToken, nextToken: token }); }); } |
| Function (anonymous_471) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· var prevToken = file.getPrevToken(token); // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. if (token.value === 'else' && prevToken.value !== '}') { return; } // Special cases for #885, using while as the keyword contradicts rule meaning // but it is more efficient and reduces complexity of the code in this rule if (token.value === 'while') { var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } errors.assert.sameLine({ token: prevToken, nextToken: token }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.value === 'else' && prevToken.value !== '}') {··· return; } |
| ✓ Negative was executed (else) | }··· // Special cases for #885, using while as the keyword contradicts rule meaning |
| Branch LogicalExpression | |
| ✓ Was returned | if (token.value === 'else' && prevToken.value !== '}') { |
| ✓ Was returned | if (token.value === 'else' && prevToken.value !== '}') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.value === 'while') {··· var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } |
| ✓ Negative was executed (else) | }··· errors.assert.sameLine({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nodes.length === 0) {··· // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } } else { |
| ✓ Negative was executed (else) | } else {··· // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.value !== '}') {··· // allow "while" that is part of a "do while" with no braces to succeed return; } |
| ✓ Negative was executed (else) | }··· } else { |
| Function (anonymous_472) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_473) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_474) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireLineFeedAtFileEnd'; }, |
| Function (anonymous_475) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var lastToken = file.getLastToken(); var prevToken = file.getPrevToken(lastToken, {includeComments: true}); errors.assert.differentLine({ token: prevToken, nextToken: lastToken, message: 'Missing line feed at file end' }); } |
| Function (anonymous_476) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_477) | |
|---|---|
| ✓ Was called | configure: function(maximumLineLength) {··· this._tabSize = ''; this._allowRegex = false; this._allowComments = false; this._allowUrlComments = false; if (typeof maximumLineLength === 'object') { assert( typeof maximumLineLength.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumLineLength = maximumLineLength.value; var tabSize = maximumLineLength.tabSize || 0; while (tabSize--) { this._tabSize += ' '; } this._allowRegex = (maximumLineLength.allowRegex === true); this._allowComments = (maximumLineLength.allowComments === true); this._allowUrlComments = (maximumLineLength.allowUrlComments === true); } else { assert( typeof maximumLineLength === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumLineLength = maximumLineLength; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof maximumLineLength === 'object') {··· assert( typeof maximumLineLength.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumLineLength = maximumLineLength.value; var tabSize = maximumLineLength.tabSize || 0; while (tabSize--) { this._tabSize += ' '; } this._allowRegex = (maximumLineLength.allowRegex === true); this._allowComments = (maximumLineLength.allowComments === true); this._allowUrlComments = (maximumLineLength.allowUrlComments === true); } else { |
| ✓ Negative was executed (else) | } else {··· assert( typeof maximumLineLength === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumLineLength = maximumLineLength; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var tabSize = maximumLineLength.tabSize || 0; |
| ✓ Was returned | var tabSize = maximumLineLength.tabSize || 0; |
| Function (anonymous_478) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'maximumLineLength'; }, |
| Function (anonymous_479) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var maximumLineLength = this._maximumLineLength; var line; var lines = this._allowComments ? file.getLinesWithCommentsRemoved() : file.getLines(); // This check should not be destructive lines = lines.slice(); if (this._allowRegex) { file.iterateTokensByType('RegularExpression', function(token) { for (var i = token.loc.start.line; i <= token.loc.end.line; i++) { lines[i - 1] = ''; } }); } if (this._allowUrlComments) { file.iterateTokensByType(['Line', 'Block'], function(comment) { for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); } for (var i = 0, l = lines.length; i < l; i++) { line = this._tabSize ? lines[i].replace(/\t/g, this._tabSize) : lines[i]; if (line.length > maximumLineLength) { errors.add( 'Line must be at most ' + maximumLineLength + ' characters', i + 1, lines[i].length ); } } } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | file.getLinesWithCommentsRemoved() : file.getLines(); |
| ✓ Negative was returned (: ...) | file.getLinesWithCommentsRemoved() : file.getLines(); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._allowRegex) {··· file.iterateTokensByType('RegularExpression', function(token) { for (var i = token.loc.start.line; i <= token.loc.end.line; i++) { lines[i - 1] = ''; } }); } |
| ✓ Negative was executed (else) | }··· if (this._allowUrlComments) { |
| Function (anonymous_480) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('RegularExpression', function(token) {··· for (var i = token.loc.start.line; i <= token.loc.end.line; i++) { lines[i - 1] = ''; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._allowUrlComments) {··· file.iterateTokensByType(['Line', 'Block'], function(comment) { for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); } |
| ✓ Negative was executed (else) | }··· for (var i = 0, l = lines.length; i < l; i++) { |
| Function (anonymous_481) | |
|---|---|
| ✓ Was called | file.iterateTokensByType(['Line', 'Block'], function(comment) {··· for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | line = this._tabSize ? lines[i].replace(/\t/g, this._tabSize) : lines[i]; |
| ✓ Negative was returned (: ...) | line = this._tabSize ? lines[i].replace(/\t/g, this._tabSize) : lines[i]; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (line.length > maximumLineLength) {··· errors.add( 'Line must be at most ' + maximumLineLength + ' characters', i + 1, lines[i].length ); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_482) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_483) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); this._operatorIndex = { '==': true, '===': true, '!=': true, '!==': true, '>': true, '<': true, '>=': true, '<=': true }; }, |
| Function (anonymous_484) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireYodaConditions'; }, |
| Function (anonymous_485) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; file.iterateNodesByType('BinaryExpression', function(node) { if (operators[node.operator]) { if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } }); } |
| Function (anonymous_486) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BinaryExpression', function(node) {··· if (operators[node.operator]) { if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[node.operator]) {··· if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add('Not yoda condition', node.left.loc.start); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | (node.right.type === 'Identifier' && node.right.name === 'undefined') |
| ✓ Was returned | if (node.right.type === 'Literal' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.right.type === 'Identifier' && node.right.name === 'undefined') |
| ✓ Was returned | (node.right.type === 'Identifier' && node.right.name === 'undefined') |
| Function (anonymous_487) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_488) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); this._operatorIndex = { '==': true, '===': true, '!=': true, '!==': true, '>': true, '<': true, '>=': true, '<=': true }; }, |
| Function (anonymous_489) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowYodaConditions'; }, |
| Function (anonymous_490) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; file.iterateNodesByType('BinaryExpression', function(node) { if (operators[node.operator]) { if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } }); } |
| Function (anonymous_491) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BinaryExpression', function(node) {··· if (operators[node.operator]) { if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[node.operator]) {··· if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add('Yoda condition', node.left.loc.start); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | (node.left.type === 'Identifier' && node.left.name === 'undefined') |
| ✓ Was returned | if (node.left.type === 'Literal' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.left.type === 'Identifier' && node.left.name === 'undefined') |
| ✓ Was returned | (node.left.type === 'Identifier' && node.left.name === 'undefined') |
| Function (anonymous_492) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_493) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | } else {··· assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_494) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Function (anonymous_495) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInsideBrackets'; }, |
| Function (anonymous_496) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateTokenByValue('[', function(token) { var nextToken = file.getNextToken(token); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after opening bracket' }); }); file.iterateTokenByValue(']', function(token) { var prevToken = file.getPrevToken(token); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: token, exactly: 1, message: 'One space required before closing bracket' }); }); } |
| Function (anonymous_497) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue('[', function(token) {··· var nextToken = file.getNextToken(token); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after opening bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === ']') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.spacesBetween({ |
| Function (anonymous_498) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue(']', function(token) {··· var prevToken = file.getPrevToken(token); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: token, exactly: 1, message: 'One space required before closing bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === '[') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.spacesBetween({ |
| Function (anonymous_499) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_500) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'allButNested') { this._exceptions['}'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'string') {··· assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✗ Negative was not executed (else) | } else {··· assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· mode = value; } |
| Function (anonymous_501) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'allButNested') {··· this._exceptions['}'] = true; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_502) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInsideObjectBrackets'; }, |
| Function (anonymous_503) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); // Don't check empty object if (nextToken.value === '}') { return; } errors.assert.spacesBetween({ token: openingBracket, nextToken: nextToken, exactly: 1, message: 'One space required after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: closingBracket, exactly: 1, message: 'One space required before closing curly brace' }); }); } |
| Function (anonymous_504) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); // Don't check empty object if (nextToken.value === '}') { return; } errors.assert.spacesBetween({ token: openingBracket, nextToken: nextToken, exactly: 1, message: 'One space required after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: closingBracket, exactly: 1, message: 'One space required before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.value === '}') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.spacesBetween({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.spacesBetween({ |
| Function (anonymous_505) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_506) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value "all" or "allButNested" or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'allButNested') { this._exceptions['['] = this._exceptions[']'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'string') {··· assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✗ Negative was not executed (else) | } else {··· assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· mode = value; } |
| Function (anonymous_507) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'allButNested') {··· this._exceptions['['] = this._exceptions[']'] = true; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_508) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInsideArrayBrackets'; }, |
| Function (anonymous_509) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateNodesByType('ArrayExpression', function(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } }); } |
| Function (anonymous_510) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ArrayExpression', function(node) {··· var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (afterOpen.value === ']') {··· return; } |
| ✓ Negative was executed (else) | }··· if (!(afterOpen.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(afterOpen.value in exceptions)) {··· errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } |
| ✓ Negative was executed (else) | }··· if (!(beforeClose.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(beforeClose.value in exceptions)) {··· errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_511) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_512) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert( 'all' in value || 'allButNested' in value, error ); } else { assert(false, error); } this._exceptions = {}; if (isObject) { mode = 'all' in value ? 'all' : 'allButNested'; (value.except || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'allButNested') { this._exceptions[')'] = this._exceptions['('] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'string') {··· assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert( 'all' in value || 'allButNested' in value, error ); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert( 'all' in value || 'allButNested' in value, error ); } else { |
| ✓ Negative was executed (else) | } else {··· assert(false, error); } |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | 'all' in value || 'allButNested' in value, |
| ✓ Was returned | 'all' in value || 'allButNested' in value, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· mode = 'all' in value ? 'all' : 'allButNested'; (value.except || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· mode = value; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | mode = 'all' in value ? 'all' : 'allButNested'; |
| ✗ Negative was not returned (: ...) | mode = 'all' in value ? 'all' : 'allButNested'; |
| Function (anonymous_513) | |
|---|---|
| ✓ Was called | (value.except || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | (value.except || []).forEach(function(value) { |
| ✓ Was returned | (value.except || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'allButNested') {··· this._exceptions[')'] = this._exceptions['('] = true; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_514) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInsideParentheses'; }, |
| Function (anonymous_515) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty parentheses if (value === ')') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening round bracket' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if (value in exceptions) { // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } // Skip for empty parentheses if (value === '(') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing round bracket' }); }); } |
| Function (anonymous_516) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue('(', function(token) {··· var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty parentheses if (value === ')') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· // Skip for empty parentheses |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === ')') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.whitespaceBetween({ |
| Function (anonymous_517) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue(')', function(token) {··· var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if (value in exceptions) { // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } // Skip for empty parentheses if (value === '(') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } |
| ✓ Negative was executed (else) | }··· // Skip for empty parentheses |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | )) {··· return; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' |
| ✓ Was returned | value === ']' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === '(') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.whitespaceBetween({ |
| Function (anonymous_518) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_519) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | } else {··· assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_520) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Function (anonymous_521) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInsideBrackets'; }, |
| Function (anonymous_522) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateTokenByValue('[', function(token) { var nextToken = file.getNextToken(token); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening bracket' }); }); file.iterateTokenByValue(']', function(token) { var prevToken = file.getPrevToken(token); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing bracket' }); }); } |
| Function (anonymous_523) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue('[', function(token) {··· var nextToken = file.getNextToken(token); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === ']') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.noWhitespaceBetween({ |
| Function (anonymous_524) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue(']', function(token) {··· var prevToken = file.getPrevToken(token); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value === '[') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.noWhitespaceBetween({ |
| Function (anonymous_525) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_526) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var mode; var modes = { 'all': true, 'nested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string "all" or "nested", true value or object'; if (typeof value === 'string' || value === true) { assert(modes[value === true ? 'all' : value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'nested') { this._exceptions['}'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'string' || value === true) {··· assert(modes[value === true ? 'all' : value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeof value === 'string' || value === true) { |
| ✓ Was returned | if (typeof value === 'string' || value === true) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | assert(modes[value === true ? 'all' : value], error); |
| ✓ Negative was returned (: ...) | assert(modes[value === true ? 'all' : value], error); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | } else {··· assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· mode = value; } |
| Function (anonymous_527) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'nested') {··· this._exceptions['}'] = true; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_528) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInsideObjectBrackets'; }, |
| Function (anonymous_529) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.noWhitespaceBetween({ token: openingBracket, nextToken: nextToken, message: 'Illegal space after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: closingBracket, message: 'Illegal space before closing curly brace' }); }); } |
| Function (anonymous_530) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.noWhitespaceBetween({ token: openingBracket, nextToken: nextToken, message: 'Illegal space after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: closingBracket, message: 'Illegal space before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.value in exceptions) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.noWhitespaceBetween({ |
| Function (anonymous_531) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_532) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var mode; var modes = { 'all': true, 'nested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value "all" or "nested" or object'; if (typeof value === 'string' || value === true) { assert(modes[value === true ? 'all' : value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'nested') { this._exceptions['['] = this._exceptions[']'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'string' || value === true) {··· assert(modes[value === true ? 'all' : value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeof value === 'string' || value === true) { |
| ✓ Was returned | if (typeof value === 'string' || value === true) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | assert(modes[value === true ? 'all' : value], error); |
| ✓ Negative was returned (: ...) | assert(modes[value === true ? 'all' : value], error); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | } else {··· assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· mode = value; } |
| Function (anonymous_533) | |
|---|---|
| ✓ Was called | (value.allExcept || []).forEach(function(value) {··· this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| ✓ Was returned | (value.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'nested') {··· this._exceptions['['] = this._exceptions[']'] = true; } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_534) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInsideArrayBrackets'; }, |
| Function (anonymous_535) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptions = this._exceptions; file.iterateNodesByType('ArrayExpression', function(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } }); } |
| Function (anonymous_536) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ArrayExpression', function(node) {··· var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (afterOpen.value === ']') {··· return; } |
| ✓ Negative was executed (else) | }··· if (!(afterOpen.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(afterOpen.value in exceptions)) {··· errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } |
| ✓ Negative was executed (else) | }··· if (!(beforeClose.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(beforeClose.value in exceptions)) {··· errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_537) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_538) | |
|---|---|
| ✓ Was called | configure: function(option) {··· var isObject = typeof option === 'object'; var error = this.getOptionName() + ' option requires' + ' true or object value with "only" properties '; // backcompat for 1.10: {all: true} #1027 if (isObject && option.all === true) { option = true; } if (typeof option === 'boolean') { assert(option === true, error); } else if (isObject) { assert('only' in option, error); } else { assert(false, error); } if (option.only) { this._only = {}; (option.only).forEach(function(value) { this._only[value] = true; }, this); } else { this._only = null; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject && option.all === true) {··· option = true; } |
| ✓ Negative was executed (else) | }··· if (typeof option === 'boolean') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (isObject && option.all === true) { |
| ✓ Was returned | if (isObject && option.all === true) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof option === 'boolean') {··· assert(option === true, error); } else if (isObject) { |
| ✓ Negative was executed (else) | } else if (isObject) {··· assert('only' in option, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (isObject) {··· assert('only' in option, error); } else { |
| ✓ Negative was executed (else) | } else {··· assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (option.only) {··· this._only = {}; (option.only).forEach(function(value) { this._only[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | } else {··· this._only = null; } |
| Function (anonymous_539) | |
|---|---|
| ✓ Was called | (option.only).forEach(function(value) {··· this._only[value] = true; }, this); |
| Function (anonymous_540) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInsideParentheses'; }, |
| Function (anonymous_541) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var only = this._only; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if (only && !(value in only)) { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening round bracket' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if (only) { if (!(value in only)) { return; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { return; } } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing round bracket' }); }); } |
| Function (anonymous_542) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue('(', function(token) {··· var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if (only && !(value in only)) { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (only && !(value in only)) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (only && !(value in only)) { |
| ✓ Was returned | if (only && !(value in only)) { |
| Function (anonymous_543) | |
|---|---|
| ✓ Was called | file.iterateTokenByValue(')', function(token) {··· var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if (only) { if (!(value in only)) { return; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { return; } } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (only) {··· if (!(value in only)) { return; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { return; } } |
| ✓ Negative was executed (else) | }··· errors.assert.noWhitespaceBetween({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(value in only)) {··· return; } |
| ✓ Negative was executed (else) | }··· if ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· return; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' |
| ✓ Was returned | value === ']' && |
| Function (anonymous_544) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_545) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || typeof options === 'number', this.getOptionName() + ' option requires the value true or an Integer' ); this._minStatements = options === true ? 0 : options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || typeof options === 'number', |
| ✓ Was returned | options === true || typeof options === 'number', |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | this._minStatements = options === true ? 0 : options; |
| ✓ Negative was returned (: ...) | this._minStatements = options === true ? 0 : options; |
| Function (anonymous_546) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireBlocksOnNewline'; }, |
| Function (anonymous_547) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var minStatements = this._minStatements; file.iterateNodesByType('BlockStatement', function(node) { if (node.body.length <= minStatements) { return; } var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); errors.assert.differentLine({ token: prevToken, nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); } |
| Function (anonymous_548) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· if (node.body.length <= minStatements) { return; } var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); errors.assert.differentLine({ token: prevToken, nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.body.length <= minStatements) {··· return; } |
| ✓ Negative was executed (else) | }··· var openingBracket = file.getFirstNodeToken(node); |
| Function (anonymous_549) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_550) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_551) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceAfterObjectKeys'; }, |
| Function (anonymous_552) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var token = file.getFirstNodeToken(property.key); errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); }); } |
| Function (anonymous_553) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var token = file.getFirstNodeToken(property.key); errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); }); |
| Function (anonymous_554) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(property) {··· if (property.shorthand || property.method || property.kind !== 'init') { return; } var token = file.getFirstNodeToken(property.key); errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (property.shorthand || property.method || property.kind !== 'init') {··· return; } |
| ✓ Negative was executed (else) | }··· var token = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Function (anonymous_555) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_556) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_557) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBeforeObjectValues'; }, |
| Function (anonymous_558) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); }); } |
| Function (anonymous_559) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); }); |
| Function (anonymous_560) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(property) {··· if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (property.shorthand || property.method || property.kind !== 'init') {··· return; } |
| ✓ Negative was executed (else) | }··· var keyToken = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Function (anonymous_561) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_562) | |
|---|---|
| ✓ Was called | configure: function(disallow) {··· var modes = { 'ignoreSingleLine': 'ignoreSingleLine', 'ignoreMultiLine': 'ignoreMultiLine' }; assert( disallow === true || typeof disallow === 'string' && modes[disallow], this.getOptionName() + ' option requires true value requires one of the following values: ' + Object.keys(modes).join(', ') ); this._mode = disallow === true ? true : modes[disallow]; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | disallow === true || typeof disallow === 'string' && modes[disallow], |
| ✓ Was returned | disallow === true || typeof disallow === 'string' && modes[disallow], |
| Branch LogicalExpression | |
| ✓ Was returned | disallow === true || typeof disallow === 'string' && modes[disallow], |
| ✗ Was not returned | disallow === true || typeof disallow === 'string' && modes[disallow], |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | this._mode = disallow === true ? true : modes[disallow]; |
| ✓ Negative was returned (: ...) | this._mode = disallow === true ? true : modes[disallow]; |
| Function (anonymous_563) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceAfterObjectKeys'; }, |
| Function (anonymous_564) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var mode = this._mode; file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { return; } if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { return; } var token = file.getFirstNodeToken(property.key); errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Illegal space after key', disallowNewLine: true }); }); }); } |
| Function (anonymous_565) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { return; } if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { return; } var token = file.getFirstNodeToken(property.key); errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Illegal space after key', disallowNewLine: true }); }); }); |
| Function (anonymous_566) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(property) {··· if (property.shorthand || property.method || property.kind !== 'init') { return; } if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { return; } if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { return; } var token = file.getFirstNodeToken(property.key); errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Illegal space after key', disallowNewLine: true }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (property.shorthand || property.method || property.kind !== 'init') {··· return; } |
| ✓ Negative was executed (else) | }··· if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { |
| ✓ Was returned | if (mode === 'ignoreSingleLine' && node.loc.start.line === node.loc.end.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· var token = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { |
| ✓ Was returned | if (mode === 'ignoreMultiLine' && node.loc.start.line !== node.loc.end.line) { |
| Function (anonymous_567) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_568) | |
|---|---|
| ✓ Was called | configure: function(disallow) {··· assert( disallow === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_569) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBeforeObjectValues'; }, |
| Function (anonymous_570) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); }); } |
| Function (anonymous_571) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); }); |
| Function (anonymous_572) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(property) {··· if (property.shorthand || property.method || property.kind !== 'init') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (property.shorthand || property.method || property.kind !== 'init') {··· return; } |
| ✓ Negative was executed (else) | }··· var keyToken = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Function (anonymous_573) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_574) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'allButReserved', this.getOptionName() + ' option requires a true value or "allButReserved"' ); this._mode = options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'allButReserved', |
| ✓ Was returned | options === true || options === 'allButReserved', |
| Function (anonymous_575) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowQuotedKeysInObjects'; }, |
| Function (anonymous_576) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var KEY_NAME_RE = /^(0|[1-9][0-9]*|[a-zA-Z_$]+[\w$]*)$/; // number or identifier var mode = this._mode; file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(prop) { var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (mode === 'allButReserved' && (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) ) { return; } errors.add('Extra quotes for key', prop.loc.start); } }); }); } |
| Function (anonymous_577) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(prop) { var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (mode === 'allButReserved' && (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) ) { return; } errors.add('Extra quotes for key', prop.loc.start); } }); }); |
| Function (anonymous_578) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(prop) {··· var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (mode === 'allButReserved' && (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) ) { return; } errors.add('Extra quotes for key', prop.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· if (mode === 'allButReserved' && (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) ) { return; } errors.add('Extra quotes for key', prop.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | KEY_NAME_RE.test(key.value) |
| ✓ Was returned | if (key.type === 'Literal' &&··· typeof key.value === 'string' && |
| Branch LogicalExpression | |
| ✓ Was returned | typeof key.value === 'string' && |
| ✓ Was returned | if (key.type === 'Literal' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.add('Extra quotes for key', prop.loc.start); |
| Branch LogicalExpression | |
| ✓ Was returned | (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) |
| ✓ Was returned | if (mode === 'allButReserved' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) |
| ✓ Was returned | (utils.isEs3Keyword(key.value) || utils.isEs3FutureReservedWord(key.value)) |
| Function (anonymous_579) | |
|---|---|
| ✓ Was called | module.exports = function() { }; |
| Function (anonymous_580) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_581) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireQuotedKeysInObjects'; }, |
| Function (anonymous_582) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(prop) { if (prop.shorthand || prop.method || prop.kind !== 'init') { return; } var key = prop.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', prop.loc.start); } }); }); } |
| Function (anonymous_583) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· node.properties.forEach(function(prop) { if (prop.shorthand || prop.method || prop.kind !== 'init') { return; } var key = prop.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', prop.loc.start); } }); }); |
| Function (anonymous_584) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(prop) {··· if (prop.shorthand || prop.method || prop.kind !== 'init') { return; } var key = prop.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', prop.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prop.shorthand || prop.method || prop.kind !== 'init') {··· return; } |
| ✓ Negative was executed (else) | }··· var key = prop.key; |
| Branch LogicalExpression | |
| ✓ Was returned | if (prop.shorthand || prop.method || prop.kind !== 'init') { |
| ✓ Was returned | if (prop.shorthand || prop.method || prop.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (prop.shorthand || prop.method || prop.kind !== 'init') { |
| ✓ Was returned | if (prop.shorthand || prop.method || prop.kind !== 'init') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!(typeof key.value === 'string' && key.type === 'Literal')) {··· errors.add('Object key without surrounding quotes', prop.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!(typeof key.value === 'string' && key.type === 'Literal')) { |
| ✓ Was returned | if (!(typeof key.value === 'string' && key.type === 'Literal')) { |
| Function (anonymous_585) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_586) | |
|---|---|
| ✓ Was called | configure: function(identifiers) {··· assert( identifiers === true || typeof identifiers === 'object', this.getOptionName() + ' option requires the value `true` ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof identifiers !== 'object' || Array.isArray(identifiers.allExcept) && typeof identifiers.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); var isTrue = identifiers === true; var defaultIdentifiers = [ '__proto__', '_', '__dirname', '__filename', 'super_' ]; if (isTrue) { identifiers = defaultIdentifiers; } else { identifiers = (identifiers.allExcept).concat(defaultIdentifiers); } this._identifierIndex = {}; for (var i = 0, l = identifiers.length; i < l; i++) { this._identifierIndex[identifiers[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof identifiers === 'object', |
| ✓ Was returned | identifiers === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(identifiers.allExcept) &&··· typeof identifiers.allExcept[0] === 'string', |
| ✓ Was returned | typeof identifiers !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof identifiers.allExcept[0] === 'string', |
| ✓ Was returned | Array.isArray(identifiers.allExcept) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· identifiers = defaultIdentifiers; } else { |
| ✓ Negative was executed (else) | } else {··· identifiers = (identifiers.allExcept).concat(defaultIdentifiers); } |
| Function (anonymous_587) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowDanglingUnderscores'; }, |
| Function (anonymous_588) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var allowedIdentifiers = this._identifierIndex; file.iterateTokensByType('Identifier', function(token) { var value = token.value; if ((value[0] === '_' || value.slice(-1) === '_') && !allowedIdentifiers[value] ) { errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } }); } |
| Function (anonymous_589) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Identifier', function(token) {··· var value = token.value; if ((value[0] === '_' || value.slice(-1) === '_') && !allowedIdentifiers[value] ) { errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | !allowedIdentifiers[value] |
| ✓ Was returned | if ((value[0] === '_' || value.slice(-1) === '_') && |
| Branch LogicalExpression | |
| ✓ Was returned | if ((value[0] === '_' || value.slice(-1) === '_') && |
| ✓ Was returned | if ((value[0] === '_' || value.slice(-1) === '_') && |
| Function (anonymous_590) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_591) | |
|---|---|
| ✓ Was called | configure: function(mode) {··· var modes = { 'all': 'all', 'ignoreFunction': 'ignoreFunction', 'ignoreLineBreak': 'ignoreLineBreak', 'skipWithFunction': 'ignoreFunction', 'skipWithLineBreak': 'ignoreLineBreak' }; assert( typeof mode === 'string' && modes[mode], this.getOptionName() + ' requires one of the following values: ' + Object.keys(modes).join(', ') ); this._mode = modes[mode]; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof mode === 'string' && modes[mode], |
| ✗ Was not returned | typeof mode === 'string' && modes[mode], |
| Function (anonymous_592) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireAlignedObjectValues'; }, |
| Function (anonymous_593) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var mode = this._mode; file.iterateNodesByType('ObjectExpression', function(node) { if (node.loc.start.line === node.loc.end.line || node.properties < 2) { return; } var maxKeyEndPos = 0; var skip = node.properties.some(function(property, index) { if (property.shorthand || property.method || property.kind !== 'init') { return true; } maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } }); if (skip) { return; } node.properties.forEach(function(property) { var keyToken = file.getFirstNodeToken(property.key); var colon = file.getNextToken(keyToken); errors.assert.spacesBetween({ token: keyToken, nextToken: colon, exactly: maxKeyEndPos - keyToken.loc.end.column + 1, message: 'Alignment required' }); }); }); } |
| Function (anonymous_594) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· if (node.loc.start.line === node.loc.end.line || node.properties < 2) { return; } var maxKeyEndPos = 0; var skip = node.properties.some(function(property, index) { if (property.shorthand || property.method || property.kind !== 'init') { return true; } maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } }); if (skip) { return; } node.properties.forEach(function(property) { var keyToken = file.getFirstNodeToken(property.key); var colon = file.getNextToken(keyToken); errors.assert.spacesBetween({ token: keyToken, nextToken: colon, exactly: maxKeyEndPos - keyToken.loc.end.column + 1, message: 'Alignment required' }); }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.loc.start.line === node.loc.end.line || node.properties < 2) {··· return; } |
| ✓ Negative was executed (else) | }··· var maxKeyEndPos = 0; |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.loc.start.line === node.loc.end.line || node.properties < 2) { |
| ✓ Was returned | if (node.loc.start.line === node.loc.end.line || node.properties < 2) { |
| Function (anonymous_595) | |
|---|---|
| ✓ Was called | var skip = node.properties.some(function(property, index) {··· if (property.shorthand || property.method || property.kind !== 'init') { return true; } maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (property.shorthand || property.method || property.kind !== 'init') {··· return true; } |
| ✓ Negative was executed (else) | }··· maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| ✓ Was returned | if (property.shorthand || property.method || property.kind !== 'init') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') {··· return true; } |
| ✓ Negative was executed (else) | }··· if (mode === 'ignoreLineBreak' && index > 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { |
| ✓ Was returned | if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) {··· return true; } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { |
| ✓ Was returned | if (mode === 'ignoreLineBreak' && index > 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | if (mode === 'ignoreLineBreak' && index > 0 && |
| ✓ Was returned | if (mode === 'ignoreLineBreak' && index > 0 && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (skip) {··· return; } |
| ✓ Negative was executed (else) | }··· node.properties.forEach(function(property) { |
| Function (anonymous_596) | |
|---|---|
| ✓ Was called | node.properties.forEach(function(property) {··· var keyToken = file.getFirstNodeToken(property.key); var colon = file.getNextToken(keyToken); errors.assert.spacesBetween({ token: keyToken, nextToken: colon, exactly: maxKeyEndPos - keyToken.loc.end.column + 1, message: 'Alignment required' }); }); |
| Function (anonymous_597) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_598) | |
|---|---|
| ✓ Was called | configure: function(options) {··· var validProperties = [ 'lineBreakAfterOpeningBrace', 'lineBreakBeforeClosingBrace' ]; var optionName = this.getOptionName(); assert( typeof options === 'object' || options === true, optionName + ' option must be an object or boolean true' ); if (typeof options === 'object') { validProperties.forEach(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'object' || options === true, |
| ✓ Was returned | typeof options === 'object' || options === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof options === 'object') {··· validProperties.forEach(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_599) | |
|---|---|
| ✓ Was called | validProperties.forEach(function(key) {··· var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isPresent) {··· assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_600) | |
|---|---|
| ✓ Was called | validProperties.forEach(function(property) {··· this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_601) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateAlignedFunctionParameters'; }, |
| Function (anonymous_602) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var lineBreakAfterOpeningBrace = this._lineBreakAfterOpeningBrace; var lineBreakBeforeClosingBrace = this._lineBreakBeforeClosingBrace; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { // ignore this rule if there are no parameters if (!(node.params && node.params.length > 0)) { return; } // ignore this rule if the parameters are not multi-line var firstParameter = file.getFirstNodeToken(node.params[0]); var lastParameter = node.params[node.params.length - 1]; if (firstParameter.loc.start.line === lastParameter.loc.end.line) { return; } // look for the furthest parameter start position var maxParamStartPos = 0; node.params.forEach(function(parameter) { maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); // make sure all parameters are lined up node.params.forEach(function(parameter) { if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); // make sure the first parameter is on a new line if (lineBreakAfterOpeningBrace) { var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } // make sure the closing brace is on a new line if (lineBreakBeforeClosingBrace) { var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } }); } |
| Function (anonymous_603) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· // ignore this rule if there are no parameters if (!(node.params && node.params.length > 0)) { return; } // ignore this rule if the parameters are not multi-line var firstParameter = file.getFirstNodeToken(node.params[0]); var lastParameter = node.params[node.params.length - 1]; if (firstParameter.loc.start.line === lastParameter.loc.end.line) { return; } // look for the furthest parameter start position var maxParamStartPos = 0; node.params.forEach(function(parameter) { maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); // make sure all parameters are lined up node.params.forEach(function(parameter) { if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); // make sure the first parameter is on a new line if (lineBreakAfterOpeningBrace) { var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } // make sure the closing brace is on a new line if (lineBreakBeforeClosingBrace) { var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (!(node.params && node.params.length > 0)) {··· return; } |
| ✓ Negative was executed (else) | }··· // ignore this rule if the parameters are not multi-line |
| Branch LogicalExpression | |
| ✓ Was returned | if (!(node.params && node.params.length > 0)) { |
| ✗ Was not returned | if (!(node.params && node.params.length > 0)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (firstParameter.loc.start.line === lastParameter.loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· // look for the furthest parameter start position |
| Function (anonymous_604) | |
|---|---|
| ✓ Was called | node.params.forEach(function(parameter) {··· maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); |
| Function (anonymous_605) | |
|---|---|
| ✓ Was called | node.params.forEach(function(parameter) {··· if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parameter.loc.start.column !== maxParamStartPos) {··· errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lineBreakAfterOpeningBrace) {··· var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } |
| ✓ Negative was executed (else) | }··· // make sure the closing brace is on a new line |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lineBreakBeforeClosingBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_606) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_607) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_608) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewLinesAfterBlocks'; }, |
| Function (anonymous_609) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var closingBracket = file.getLastNodeToken(node); var nextToken = file.getNextToken(closingBracket); while (nextToken.type !== 'EOF') { if (closingBracket.loc.end.line === nextToken.loc.start.line) { nextToken = file.getNextToken(nextToken); continue; } errors.assert.linesBetween({ token: closingBracket, nextToken: nextToken, atMost: 1, message: 'Extra newline after closing curly brace' }); return; } }); } |
| Function (anonymous_610) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var closingBracket = file.getLastNodeToken(node); var nextToken = file.getNextToken(closingBracket); while (nextToken.type !== 'EOF') { if (closingBracket.loc.end.line === nextToken.loc.start.line) { nextToken = file.getNextToken(nextToken); continue; } errors.assert.linesBetween({ token: closingBracket, nextToken: nextToken, atMost: 1, message: 'Extra newline after closing curly brace' }); return; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (closingBracket.loc.end.line === nextToken.loc.start.line) {··· nextToken = file.getNextToken(nextToken); continue; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Function isException | |
|---|---|
| ✓ Was called | function isException(parent) {··· var grandpa = parent.parentNode; // Check if this block is used in call or array expression if (exceptions[grandpa.type]) { if (grandpa.arguments) { return grandpa.arguments.indexOf(parent) > -1; } else { return true; } } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (exceptions[grandpa.type]) {··· if (grandpa.arguments) { return grandpa.arguments.indexOf(parent) > -1; } else { return true; } } |
| ✓ Negative was executed (else) | }··· return false; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (grandpa.arguments) {··· return grandpa.arguments.indexOf(parent) > -1; } else { |
| ✓ Negative was executed (else) | } else {··· return true; } |
| Function (anonymous_612) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_613) | |
|---|---|
| ✓ Was called | configure: function(value) {··· var optionName = this.getOptionName(); if (typeof value === 'object') { assert(Array.isArray(value.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(value.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); value.allExcept.forEach(function(except) { if (except === 'inCallExpressions') { exceptions.CallExpression = true; } else if (except === 'inArrayExpressions') { exceptions.ArrayExpression = true; } else if (except === 'inProperties') { exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } }); } else { assert(value === true, optionName + ' option requires true value or object' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'object') {··· assert(Array.isArray(value.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(value.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); value.allExcept.forEach(function(except) { if (except === 'inCallExpressions') { exceptions.CallExpression = true; } else if (except === 'inArrayExpressions') { exceptions.ArrayExpression = true; } else if (except === 'inProperties') { exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } }); } else { |
| ✓ Negative was executed (else) | } else {··· assert(value === true, optionName + ' option requires true value or object' ); } |
| Function (anonymous_614) | |
|---|---|
| ✓ Was called | value.allExcept.forEach(function(except) {··· if (except === 'inCallExpressions') { exceptions.CallExpression = true; } else if (except === 'inArrayExpressions') { exceptions.ArrayExpression = true; } else if (except === 'inProperties') { exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (except === 'inCallExpressions') {··· exceptions.CallExpression = true; } else if (except === 'inArrayExpressions') { |
| ✓ Negative was executed (else) | } else if (except === 'inArrayExpressions') {··· exceptions.ArrayExpression = true; } else if (except === 'inProperties') { exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (except === 'inArrayExpressions') {··· exceptions.ArrayExpression = true; } else if (except === 'inProperties') { |
| ✓ Negative was executed (else) | } else if (except === 'inProperties') {··· exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (except === 'inProperties') {··· exceptions.Property = true; } else { |
| ✓ Negative was executed (else) | } else {··· assert(false, optionName + ' option requires "allExcept" to only have ' + '"inCallExpressions" or "inArrayExpressions"'); } |
| Function (anonymous_615) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLinesAfterBlocks'; }, |
| Function (anonymous_616) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var closingBracket = file.getLastNodeToken(node); var parentNode = node.parentNode; if (isException(parentNode)) { return; } var nextToken = file.getNextToken(closingBracket); while (nextToken.type !== 'EOF') { var excludeValues = excludes[parentNode.type]; if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { return; } if (closingBracket.loc.end.line === nextToken.loc.start.line) { nextToken = file.getNextToken(nextToken); continue; } if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.linesBetween({ token: closingBracket, nextToken: nextToken, atLeast: 2, message: 'Missing newline after block' }); return; } }); } |
| Function (anonymous_617) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var closingBracket = file.getLastNodeToken(node); var parentNode = node.parentNode; if (isException(parentNode)) { return; } var nextToken = file.getNextToken(closingBracket); while (nextToken.type !== 'EOF') { var excludeValues = excludes[parentNode.type]; if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { return; } if (closingBracket.loc.end.line === nextToken.loc.start.line) { nextToken = file.getNextToken(nextToken); continue; } if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.linesBetween({ token: closingBracket, nextToken: nextToken, atLeast: 2, message: 'Missing newline after block' }); return; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isException(parentNode)) {··· return; } |
| ✓ Negative was executed (else) | }··· var nextToken = file.getNextToken(closingBracket); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) {··· return; } |
| ✓ Negative was executed (else) | }··· if (closingBracket.loc.end.line === nextToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { |
| ✗ Was not returned | if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (closingBracket.loc.end.line === nextToken.loc.start.line) {··· nextToken = file.getNextToken(nextToken); continue; } |
| ✓ Negative was executed (else) | }··· if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'Punctuator' && nextToken.value === '}') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Function (anonymous_618) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_619) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_620) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewlinesInBlocks'; }, |
| Function (anonymous_621) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atMost: 1, message: 'Expected no padding newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atMost: 1, message: 'Expected no padding newline before closing curly brace' }); }); } |
| Function (anonymous_622) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atMost: 1, message: 'Expected no padding newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atMost: 1, message: 'Expected no padding newline before closing curly brace' }); }); |
| Function (anonymous_623) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_624) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || typeof options === 'number', this.getOptionName() + ' option requires the value true or an Integer' ); this._minStatements = options === true ? 0 : options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || typeof options === 'number', |
| ✓ Was returned | options === true || typeof options === 'number', |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | this._minStatements = options === true ? 0 : options; |
| ✓ Negative was returned (: ...) | this._minStatements = options === true ? 0 : options; |
| Function (anonymous_625) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewlinesInBlocks'; }, |
| Function (anonymous_626) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var minStatements = this._minStatements; file.iterateNodesByType('BlockStatement', function(node) { if (node.body.length <= minStatements) { return; } var openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atLeast: 2, message: 'Expected a padding newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atLeast: 2, message: 'Expected a padding newline before closing curly brace' }); }); } |
| Function (anonymous_627) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· if (node.body.length <= minStatements) { return; } var openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atLeast: 2, message: 'Expected a padding newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atLeast: 2, message: 'Expected a padding newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.body.length <= minStatements) {··· return; } |
| ✓ Negative was executed (else) | }··· var openingBracket = file.getFirstNodeToken(node); |
| Function (anonymous_628) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_629) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_630) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLinesInObjects'; }, |
| Function (anonymous_631) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.differentLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); } |
| Function (anonymous_632) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.differentLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'Punctuator' && nextToken.value === '}') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.differentLine({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Function (anonymous_633) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_634) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_635) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewLinesInObjects'; }, |
| Function (anonymous_636) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.sameLine({ token: openingBracket, nextToken: nextToken, message: 'Illegal newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.sameLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Illegal newline before closing curly brace' }); }); } |
| Function (anonymous_637) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ObjectExpression', function(node) {··· var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.sameLine({ token: openingBracket, nextToken: nextToken, message: 'Illegal newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.sameLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Illegal newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'Punctuator' && nextToken.value === '}') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.sameLine({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| ✓ Was returned | if (nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Function (anonymous_638) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_639) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_640) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireNewlineBeforeBlockStatements'; }, |
| Function (anonymous_641) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); errors.assert.differentLine({ token: prevToken, nextToken: openingBrace, message: 'Missing newline before curly brace for block statement' }); }); } |
| Function (anonymous_642) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); errors.assert.differentLine({ token: prevToken, nextToken: openingBrace, message: 'Missing newline before curly brace for block statement' }); }); |
| Function (anonymous_643) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_644) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_645) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowNewlineBeforeBlockStatements'; }, |
| Function (anonymous_646) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); errors.assert.sameLine({ token: prevToken, nextToken: openingBrace, message: 'Newline before curly brace for block statement is disallowed' }); }); } |
| Function (anonymous_647) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); errors.assert.sameLine({ token: prevToken, nextToken: openingBrace, message: 'Newline before curly brace for block statement is disallowed' }); }); |
| Function (anonymous_648) | |
|---|---|
| ✓ Was called | module.exports = function() { }; |
| Function (anonymous_649) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert(Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | assert(Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_650) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewlinesBeforeKeywords'; }, |
| Function (anonymous_651) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var excludedTokens = [':', ',', '(', '=']; file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token); // Handle special case of 'else if' construct. if (token.value === 'if' && prevToken && prevToken.value === 'else') { return; // Handling for special cases. } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } // Handle all other cases // The { character is there to handle the case of a matching token which happens to be the first // statement in a block // The ) character is there to handle the case of `if (...) matchingKeyword` in which case // requiring padding would break the statement if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } }); } |
| Function (anonymous_652) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· var prevToken = file.getPrevToken(token); // Handle special case of 'else if' construct. if (token.value === 'if' && prevToken && prevToken.value === 'else') { return; // Handling for special cases. } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } // Handle all other cases // The { character is there to handle the case of a matching token which happens to be the first // statement in a block // The ) character is there to handle the case of `if (...) matchingKeyword` in which case // requiring padding would break the statement if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (token.value === 'if' && prevToken && prevToken.value === 'else') {··· return; // Handling for special cases. } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { |
| ✓ Negative was executed (else) | } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) {··· return; } |
| Branch LogicalExpression | |
| ✓ Was returned | if (token.value === 'if' && prevToken && prevToken.value === 'else') { |
| ✓ Was returned | if (token.value === 'if' && prevToken && prevToken.value === 'else') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (token.value === 'if' && prevToken && prevToken.value === 'else') { |
| ✓ Was returned | if (token.value === 'if' && prevToken && prevToken.value === 'else') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) {··· return; } |
| ✓ Negative was executed (else) | }··· // Handle all other cases |
| Branch LogicalExpression | |
| ✓ Was returned | } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { |
| ✓ Was returned | } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') {··· errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| ✓ Was returned | if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| ✓ Was returned | if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| Function (anonymous_653) | |
|---|---|
| ✓ Was called | module.exports = function() { }; |
| Function (anonymous_654) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert(Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(Array.isArray(keywords) || keywords === true, |
| ✓ Was returned | assert(Array.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (keywords === true) {··· keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | }··· this._keywords = keywords; |
| Function (anonymous_655) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewlinesBeforeKeywords'; }, |
| Function (anonymous_656) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.assert.linesBetween({ token: file.getPrevToken(token), nextToken: token, atMost: 1, message: 'Keyword `' + token.value + '` should not have an empty line above it' }); }); } |
| Function (anonymous_657) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {··· errors.assert.linesBetween({ token: file.getPrevToken(token), nextToken: token, atMost: 1, message: 'Keyword `' + token.value + '` should not have an empty line above it' }); }); |
| Function (anonymous_658) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_659) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_660) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewLinesBeforeLineComments'; }, |
| Function (anonymous_661) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByType('Line', function(comment) { if (comment.loc.start.line === 1) { return; } errors.assert.linesBetween({ token: file.getPrevToken(comment, {includeComments: true}), nextToken: comment, atMost: 1, message: 'Line comments must not be preceded with a blank line' }); }); } |
| Function (anonymous_662) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Line', function(comment) {··· if (comment.loc.start.line === 1) { return; } errors.assert.linesBetween({ token: file.getPrevToken(comment, {includeComments: true}), nextToken: comment, atMost: 1, message: 'Line comments must not be preceded with a blank line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (comment.loc.start.line === 1) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Function (anonymous_663) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_664) | |
|---|---|
| ✓ Was called | configure: function(value) {··· this._allowFirstAfterCurly = false; if (typeof value === 'object') { assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', this.getOptionName() + ' option requires the "allExcept" ' + 'property to equal "firstAfterCurly"'); this._allowFirstAfterCurly = true; } else { assert(value === true, this.getOptionName() + ' option requires true value or object' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof value === 'object') {··· assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', this.getOptionName() + ' option requires the "allExcept" ' + 'property to equal "firstAfterCurly"'); this._allowFirstAfterCurly = true; } else { |
| ✓ Negative was executed (else) | } else {··· assert(value === true, this.getOptionName() + ' option requires true value or object' ); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', |
| ✓ Was returned | assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', |
| Function (anonymous_665) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLinesBeforeLineComments'; }, |
| Function (anonymous_666) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var allowFirstAfterCurly = this._allowFirstAfterCurly; file.iterateTokensByType('Line', function(comment) { if (comment.loc.start.line === 1) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); // Should not consider code and comment on the same line (#1194) if (firstToken !== undefined && firstToken.type !== 'EOF') { return; } var prevToken = file.getPrevToken(comment, {includeComments: true}); if (prevToken.type === 'Line') { return; } if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { return; } errors.assert.linesBetween({ token: prevToken, nextToken: comment, atLeast: 2, message: 'Line comments must be preceded with a blank line' }); }); } |
| Function (anonymous_667) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Line', function(comment) {··· if (comment.loc.start.line === 1) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); // Should not consider code and comment on the same line (#1194) if (firstToken !== undefined && firstToken.type !== 'EOF') { return; } var prevToken = file.getPrevToken(comment, {includeComments: true}); if (prevToken.type === 'Line') { return; } if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { return; } errors.assert.linesBetween({ token: prevToken, nextToken: comment, atLeast: 2, message: 'Line comments must be preceded with a blank line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (comment.loc.start.line === 1) {··· return; } |
| ✓ Negative was executed (else) | }··· var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (firstToken !== undefined && firstToken.type !== 'EOF') {··· return; } |
| ✓ Negative was executed (else) | }··· var prevToken = file.getPrevToken(comment, {includeComments: true}); |
| Branch LogicalExpression | |
| ✓ Was returned | if (firstToken !== undefined && firstToken.type !== 'EOF') { |
| ✓ Was returned | if (firstToken !== undefined && firstToken.type !== 'EOF') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevToken.type === 'Line') {··· return; } |
| ✓ Negative was executed (else) | }··· if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| ✓ Was returned | if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| ✓ Was returned | if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Function (anonymous_668) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_669) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_670) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowTrailingComma'; }, |
| Function (anonymous_671) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) { var closingToken = file.getLastNodeToken(node); errors.assert.noTokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Extra comma following the final element of an array or object literal' }); }); } |
| Function (anonymous_672) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) {··· var closingToken = file.getLastNodeToken(node); errors.assert.noTokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Extra comma following the final element of an array or object literal' }); }); |
| Function (anonymous_673) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_674) | |
|---|---|
| ✓ Was called | configure: function(options) {··· if (typeof options === 'object') { if ('ignoreSingleValue' in options) { assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } if ('ignoreSingleLine' in options) { assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } } else { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof options === 'object') {··· if ('ignoreSingleValue' in options) { assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } if ('ignoreSingleLine' in options) { assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } } else { |
| ✓ Negative was executed (else) | } else {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('ignoreSingleValue' in options) {··· assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } |
| ✓ Negative was executed (else) | }··· if ('ignoreSingleLine' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('ignoreSingleLine' in options) {··· assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } |
| ✓ Negative was executed (else) | }··· } else { |
| Function (anonymous_675) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireTrailingComma'; }, |
| Function (anonymous_676) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var _this = this; file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) { var isObject = node.type === 'ObjectExpression'; var entities = isObject ? node.properties : node.elements; if (entities.length === 0) { return; } if (_this._ignoreSingleValue && entities.length === 1) { return; } if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { return; } var closingToken = file.getLastNodeToken(node); errors.assert.tokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Missing comma before closing ' + (isObject ? ' curly brace' : ' bracket') }); }); } |
| Function (anonymous_677) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) {··· var isObject = node.type === 'ObjectExpression'; var entities = isObject ? node.properties : node.elements; if (entities.length === 0) { return; } if (_this._ignoreSingleValue && entities.length === 1) { return; } if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { return; } var closingToken = file.getLastNodeToken(node); errors.assert.tokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Missing comma before closing ' + (isObject ? ' curly brace' : ' bracket') }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var entities = isObject ? node.properties : node.elements; |
| ✓ Negative was returned (: ...) | var entities = isObject ? node.properties : node.elements; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (entities.length === 0) {··· return; } |
| ✓ Negative was executed (else) | }··· if (_this._ignoreSingleValue && entities.length === 1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this._ignoreSingleValue && entities.length === 1) {··· return; } |
| ✓ Negative was executed (else) | }··· if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (_this._ignoreSingleValue && entities.length === 1) { |
| ✓ Was returned | if (_this._ignoreSingleValue && entities.length === 1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· var closingToken = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { |
| ✓ Was returned | if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | message: 'Missing comma before closing ' + (isObject ? ' curly brace' : ' bracket') |
| ✓ Negative was returned (: ...) | message: 'Missing comma before closing ' + (isObject ? ' curly brace' : ' bracket') |
| Function (anonymous_678) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_679) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'ignoreProperties', this.getOptionName() + ' option requires true or "ignoreProperties" value, or should be removed' ); this._ignoreProperties = (options === 'ignoreProperties'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'ignoreProperties', |
| ✓ Was returned | options === true || options === 'ignoreProperties', |
| Function (anonymous_680) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireDollarBeforejQueryAssignment'; }, |
| Function (anonymous_681) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var ignoreProperties = this._ignoreProperties; file.iterateNodesByType(['VariableDeclarator', 'AssignmentExpression', 'ObjectExpression'], function(token) { var type = token.type; var left; var varName; var right; if (type === 'VariableDeclarator') { left = token.id; varName = left.name; right = token.init; } else if (ignoreProperties) { return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; } else {// type === 'ObjectExpression' var props = token.properties[0]; if (!props) { return; } left = props.key; if (!left.name) { return; } varName = left.name; right = props.value; } if (varName.indexOf('$') === 0 || varName.indexOf('_$') === 0) { return; } if (!right || right.type !== 'CallExpression') { return; } var nextToken = file.getTokenByRangeStart(right.callee.range[0]); if (nextToken.value !== '$') { return; } nextToken = file.getNextToken(nextToken); if (nextToken.value !== '(') { return; } while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { nextToken = file.getNextToken(nextToken); } nextToken = file.getNextToken(nextToken); if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } }); } |
| Function (anonymous_682) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['VariableDeclarator', 'AssignmentExpression', 'ObjectExpression'], function(token) {··· var type = token.type; var left; var varName; var right; if (type === 'VariableDeclarator') { left = token.id; varName = left.name; right = token.init; } else if (ignoreProperties) { return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; } else {// type === 'ObjectExpression' var props = token.properties[0]; if (!props) { return; } left = props.key; if (!left.name) { return; } varName = left.name; right = props.value; } if (varName.indexOf('$') === 0 || varName.indexOf('_$') === 0) { return; } if (!right || right.type !== 'CallExpression') { return; } var nextToken = file.getTokenByRangeStart(right.callee.range[0]); if (nextToken.value !== '$') { return; } nextToken = file.getNextToken(nextToken); if (nextToken.value !== '(') { return; } while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { nextToken = file.getNextToken(nextToken); } nextToken = file.getNextToken(nextToken); if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (type === 'VariableDeclarator') {··· left = token.id; varName = left.name; right = token.init; } else if (ignoreProperties) { |
| ✓ Negative was executed (else) | } else if (ignoreProperties) {··· return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; } else {// type === 'ObjectExpression' var props = token.properties[0]; if (!props) { return; } left = props.key; if (!left.name) { return; } varName = left.name; right = props.value; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (ignoreProperties) {··· return; } else if (type === 'AssignmentExpression') { |
| ✓ Negative was executed (else) | } else if (type === 'AssignmentExpression') {··· left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; } else {// type === 'ObjectExpression' var props = token.properties[0]; if (!props) { return; } left = props.key; if (!left.name) { return; } varName = left.name; right = props.value; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (type === 'AssignmentExpression') {··· left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; } else {// type === 'ObjectExpression' |
| ✓ Negative was executed (else) | } else {// type === 'ObjectExpression'··· var props = token.properties[0]; if (!props) { return; } left = props.key; if (!left.name) { return; } varName = left.name; right = props.value; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (left.computed) {··· return; } |
| ✓ Negative was executed (else) | }··· varName = left.name || left.property.name; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | varName = left.name || left.property.name; |
| ✓ Was returned | varName = left.name || left.property.name; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!props) {··· return; } |
| ✓ Negative was executed (else) | }··· left = props.key; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!left.name) {··· return; } |
| ✓ Negative was executed (else) | }··· varName = left.name; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (varName.indexOf('$') === 0 || varName.indexOf('_$') === 0) {··· return; } |
| ✓ Negative was executed (else) | }··· if (!right || right.type !== 'CallExpression') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (varName.indexOf('$') === 0 || varName.indexOf('_$') === 0) { |
| ✓ Was returned | if (varName.indexOf('$') === 0 || varName.indexOf('_$') === 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!right || right.type !== 'CallExpression') {··· return; } |
| ✓ Negative was executed (else) | }··· var nextToken = file.getTokenByRangeStart(right.callee.range[0]); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!right || right.type !== 'CallExpression') { |
| ✓ Was returned | if (!right || right.type !== 'CallExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.value !== '$') {··· return; } |
| ✓ Negative was executed (else) | }··· nextToken = file.getNextToken(nextToken); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.value !== '(') {··· return; } |
| ✓ Negative was executed (else) | }··· while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { |
| ✓ Was returned | while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) {··· errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| ✗ Was not returned | if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| ✓ Was returned | if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| Function (anonymous_683) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_684) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_685) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowCommaBeforeLineBreak'; }, |
| Function (anonymous_686) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Commas should be placed on new line' }); }); } |
| Function (anonymous_687) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Commas should be placed on new line' }); }); |
| Function (anonymous_688) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_689) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_690) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireCommaBeforeLineBreak'; }, |
| Function (anonymous_691) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.sameLine({ token: file.getPrevToken(token), nextToken: token, message: 'Commas should not be placed on new line' }); }); } |
| Function (anonymous_692) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.sameLine({ token: file.getPrevToken(token), nextToken: token, message: 'Commas should not be placed on new line' }); }); |
| Function (anonymous_693) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_694) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_695) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBeforeBlockStatements'; }, |
| Function (anonymous_696) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('BlockStatement', function(node) { var first = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(first), nextToken: first, disallowNewLine: true, message: 'Extra space before opening curly brace for block expressions' }); }); } |
| Function (anonymous_697) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var first = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(first), nextToken: first, disallowNewLine: true, message: 'Extra space before opening curly brace for block expressions' }); }); |
| Function (anonymous_698) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_699) | |
|---|---|
| ✓ Was called | configure: function(requireSpaceBeforeBlockStatements) {··· assert( typeof requireSpaceBeforeBlockStatements === 'boolean' || typeof requireSpaceBeforeBlockStatements === 'number', this.getOptionName() + ' option requires number or bolean' ); assert( requireSpaceBeforeBlockStatements >= 1, this.getOptionName() + ' option requires true value or a number greater than equal to 1 or should be removed' ); this._count = +requireSpaceBeforeBlockStatements; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof requireSpaceBeforeBlockStatements === 'number', |
| ✓ Was returned | typeof requireSpaceBeforeBlockStatements === 'boolean' || |
| Function (anonymous_700) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBeforeBlockStatements'; }, |
| Function (anonymous_701) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var count = this._count; file.iterateNodesByType('BlockStatement', function(node) { var first = file.getFirstNodeToken(node); errors.assert.spacesBetween({ token: file.getPrevToken(first), nextToken: first, atLeast: count, disallowNewLine: true, message: 'One (or more) spaces required before opening brace for block expressions' }); }); } |
| Function (anonymous_702) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('BlockStatement', function(node) {··· var first = file.getFirstNodeToken(node); errors.assert.spacesBetween({ token: file.getPrevToken(first), nextToken: first, atLeast: count, disallowNewLine: true, message: 'One (or more) spaces required before opening brace for block expressions' }); }); |
| Function (anonymous_703) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_704) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_705) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBeforePostfixUnaryOperators'; }, |
| Function (anonymous_706) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operatorIndex = this._operatorIndex; // 'UpdateExpression' involve only ++ and -- operators file.iterateNodesByType('UpdateExpression', function(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } }); } |
| Function (anonymous_707) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('UpdateExpression', function(node) {··· // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!node.prefix && operatorIndex[node.operator]) {··· var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!node.prefix && operatorIndex[node.operator]) { |
| ✓ Was returned | if (!node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_708) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_709) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_710) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBeforePostfixUnaryOperators'; }, |
| Function (anonymous_711) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operatorIndex = this._operatorIndex; // 'UpdateExpression' involve only ++ and -- operators file.iterateNodesByType('UpdateExpression', function(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); } |
| Function (anonymous_712) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('UpdateExpression', function(node) {··· // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!node.prefix && operatorIndex[node.operator]) {··· var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } |
| ✗ Negative was not executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!node.prefix && operatorIndex[node.operator]) { |
| ✗ Was not returned | if (!node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_713) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_714) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_715) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceAfterPrefixUnaryOperators'; }, |
| Function (anonymous_716) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operatorIndex = this._operatorIndex; file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } }); } |
| Function (anonymous_717) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) {··· // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.prefix && operatorIndex[node.operator]) {··· var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.prefix && operatorIndex[node.operator]) { |
| ✓ Was returned | if (node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_718) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_719) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = defaultOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_720) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceAfterPrefixUnaryOperators'; }, |
| Function (anonymous_721) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operatorIndex = this._operatorIndex; file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); } |
| Function (anonymous_722) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) {··· // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.prefix && operatorIndex[node.operator]) {··· var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.prefix && operatorIndex[node.operator]) { |
| ✗ Was not returned | if (node.prefix && operatorIndex[node.operator]) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | argument === 'UnaryExpression' || argument === 'UpdateExpression' &&··· nextToken.value !== '(' |
| ✓ Was returned | argument === 'UnaryExpression' || argument === 'UpdateExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | nextToken.value !== '(' |
| ✓ Was returned | argument === 'UnaryExpression' || argument === 'UpdateExpression' && |
| Function (anonymous_723) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_724) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = allOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_725) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBeforeBinaryOperators'; }, |
| Function (anonymous_726) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken, {includeComments: true}); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[',']) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); } |
| ✓ Negative was executed (else) | }··· // For everything else |
| Function (anonymous_727) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); |
| Function (anonymous_728) | |
|---|---|
| ✓ Was called | function(node) {··· var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken, {includeComments: true}); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'VariableDeclarator') {··· expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | } else {··· operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression === null) {··· return; } |
| ✓ Negative was executed (else) | }··· var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[operator]) {··· errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_730) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_731) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = allOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_732) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBeforeBinaryOperators'; }, |
| Function (anonymous_733) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to preceding expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[',']) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); } |
| ✓ Negative was executed (else) | }··· // For everything else |
| Function (anonymous_734) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); |
| Function (anonymous_735) | |
|---|---|
| ✓ Was called | function(node) {··· var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to preceding expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'VariableDeclarator') {··· expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | } else {··· operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression === null) {··· return; } |
| ✓ Negative was executed (else) | }··· var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[operator]) {··· errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to preceding expression' }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_736) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_737) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isTrue) {··· operators = allOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_738) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceAfterBinaryOperators'; }, |
| Function (anonymous_739) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[',']) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); } |
| ✓ Negative was executed (else) | }··· // For everything else |
| Function (anonymous_740) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); |
| Function (anonymous_741) | |
|---|---|
| ✓ Was called | function(node) {··· var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'VariableDeclarator') {··· expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | } else {··· operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression === null) {··· return; } |
| ✓ Negative was executed (else) | }··· var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[operator]) {··· errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_742) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_743) | |
|---|---|
| ✓ Was called | configure: function(operators) {··· var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | Array.isArray(operators) || isTrue, |
| ✓ Was returned | Array.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | if (isTrue) {··· operators = allOperators; } |
| ✓ Negative was executed (else) | }··· this._operatorIndex = {}; |
| Function (anonymous_744) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceAfterBinaryOperators'; }, |
| Function (anonymous_745) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[',']) {··· file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); } |
| ✓ Negative was executed (else) | }··· // For everything else |
| Function (anonymous_746) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) {··· errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); |
| Function (anonymous_747) | |
|---|---|
| ✓ Was called | function(node) {··· var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'VariableDeclarator') {··· expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | } else {··· operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression === null) {··· return; } |
| ✓ Negative was executed (else) | }··· var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (operators[operator]) {··· errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_748) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_749) | |
|---|---|
| ✓ Was called | configure: function(options) {··· var validProperties = [ 'afterTest', 'beforeConsequent', 'afterConsequent', 'beforeAlternate' ]; var optionName = this.getOptionName(); if (options === true) { options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } assert( typeof options === 'object', optionName + ' option requires a true value or an object' ); var isProperlyConfigured = validProperties.some(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); assert( isProperlyConfigured, optionName + ' must have at least 1 of the following properties: ' + validProperties.join(', ') ); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options === true) {··· options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } |
| ✓ Negative was executed (else) | }··· assert( |
| Function (anonymous_750) | |
|---|---|
| ✓ Was called | var isProperlyConfigured = validProperties.some(function(key) {··· var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isPresent) {··· assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· return isPresent; |
| Function (anonymous_751) | |
|---|---|
| ✓ Was called | validProperties.forEach(function(property) {··· this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_752) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInConditionalExpression'; }, |
| Function (anonymous_753) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['ConditionalExpression'], function(node) { var consequent = node.consequent; var alternate = node.alternate; var consequentToken = file.getFirstNodeToken(consequent); var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest) { token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } if (this._beforeConsequent) { token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } if (this._afterConsequent) { token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } if (this._beforeAlternate) { token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } }.bind(this)); } |
| Function (anonymous_754) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['ConditionalExpression'], function(node) {··· var consequent = node.consequent; var alternate = node.alternate; var consequentToken = file.getFirstNodeToken(consequent); var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest) { token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } if (this._beforeConsequent) { token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } if (this._afterConsequent) { token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } if (this._beforeAlternate) { token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._afterTest) {··· token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } |
| ✓ Negative was executed (else) | }··· if (this._beforeConsequent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._beforeConsequent) {··· token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } |
| ✓ Negative was executed (else) | }··· if (this._afterConsequent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._afterConsequent) {··· token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } |
| ✓ Negative was executed (else) | }··· if (this._beforeAlternate) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._beforeAlternate) {··· token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } |
| ✓ Negative was executed (else) | }··· }.bind(this)); |
| Function (anonymous_755) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_756) | |
|---|---|
| ✓ Was called | configure: function(options) {··· var validProperties = [ 'afterTest', 'beforeConsequent', 'afterConsequent', 'beforeAlternate' ]; var optionName = this.getOptionName(); if (options === true) { options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } assert( typeof options === 'object', optionName + ' option requires a true value or an object' ); var isProperlyConfigured = validProperties.some(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); assert( isProperlyConfigured, optionName + ' must have at least 1 of the following properties: ' + validProperties.join(', ') ); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options === true) {··· options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } |
| ✓ Negative was executed (else) | }··· assert( |
| Function (anonymous_757) | |
|---|---|
| ✓ Was called | var isProperlyConfigured = validProperties.some(function(key) {··· var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isPresent) {··· assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· return isPresent; |
| Function (anonymous_758) | |
|---|---|
| ✓ Was called | validProperties.forEach(function(property) {··· this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_759) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInConditionalExpression'; }, |
| Function (anonymous_760) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['ConditionalExpression'], function(node) { var test = node.test; var consequent = node.consequent; var consequentToken = file.getFirstNodeToken(consequent); var alternate = node.alternate; var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } }.bind(this)); } |
| Function (anonymous_761) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['ConditionalExpression'], function(node) {··· var test = node.test; var consequent = node.consequent; var consequentToken = file.getFirstNodeToken(consequent); var alternate = node.alternate; var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) {··· token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } |
| ✓ Negative was executed (else) | }··· if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { |
| ✓ Was returned | if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) {··· token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } |
| ✓ Negative was executed (else) | }··· if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { |
| ✓ Was returned | if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) {··· token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } |
| ✓ Negative was executed (else) | }··· if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { |
| ✓ Was returned | if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) {··· token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } |
| ✓ Negative was executed (else) | }··· }.bind(this)); |
| Branch LogicalExpression | |
| ✓ Was returned | if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { |
| ✓ Was returned | if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { |
| Function (anonymous_762) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_763) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_764) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInFunction'; }, |
| Function (anonymous_765) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); } |
| Function (anonymous_766) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_767) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_768) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_769) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInFunction'; }, |
| Function (anonymous_770) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); } |
| Function (anonymous_771) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_772) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_773) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_774) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInFunctionExpression'; }, |
| Function (anonymous_775) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType('FunctionExpression', function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); } |
| Function (anonymous_776) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('FunctionExpression', function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_777) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_778) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_779) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInFunctionExpression'; }, |
| Function (anonymous_780) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType('FunctionExpression', function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); } |
| Function (anonymous_781) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('FunctionExpression', function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_782) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_783) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_784) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInAnonymousFunctionExpression'; }, |
| Function (anonymous_785) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (!node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } }); } |
| Function (anonymous_786) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression'], function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } if (!node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· if (!node.id) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!node.id) {··· if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } |
| ✗ Negative was not executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· var functionToken = file.getFirstNodeToken(node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_787) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_788) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_789) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInAnonymousFunctionExpression'; }, |
| Function (anonymous_790) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); } |
| Function (anonymous_791) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression'], function(node) {··· var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {··· return; } |
| ✓ Negative was executed (else) | }··· // anonymous function expressions only |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id) {··· return; } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningRoundBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· var functionToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_792) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_793) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_794) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInNamedFunctionExpression'; }, |
| Function (anonymous_795) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } } }); } |
| Function (anonymous_796) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression'], function(node) {··· if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id) {··· if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· var functionToken = file.getFirstNodeToken(node.id); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_797) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_798) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_799) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInNamedFunctionExpression'; }, |
| Function (anonymous_800) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } } }); } |
| Function (anonymous_801) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression'], function(node) {··· // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id) {··· if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_802) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_803) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_804) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInFunctionDeclaration'; }, |
| Function (anonymous_805) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration'], function(node) { if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); } |
| Function (anonymous_806) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration'], function(node) {··· if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| ✓ Was returned | var functionToken = file.getFirstNodeToken(node.id || node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_807) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_808) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningRoundBrace' in options) {··· assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('beforeOpeningCurlyBrace' in options) {··· assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | }··· assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| ✓ Was returned | options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_809) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInFunctionDeclaration'; }, |
| Function (anonymous_810) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration'], function(node) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); } |
| Function (anonymous_811) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration'], function(node) {··· if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningRoundBrace) {··· var functionToken = file.getFirstNodeToken(node.id); errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace', }); } |
| ✓ Negative was executed (else) | }··· if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (beforeOpeningCurlyBrace) {··· var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace', }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_812) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_813) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_814) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInCallExpression'; }, |
| Function (anonymous_815) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('CallExpression', function(node) { var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.whitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Missing space before opening round brace' }); }); } |
| Function (anonymous_816) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('CallExpression', function(node) {··· var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.whitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Missing space before opening round brace' }); }); |
| Function (anonymous_817) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_818) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_819) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInCallExpression'; }, |
| Function (anonymous_820) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('CallExpression', function(node) { var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Illegal space before opening round brace' }); }); } |
| Function (anonymous_821) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('CallExpression', function(node) {··· var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Illegal space before opening round brace' }); }); |
| Function (anonymous_822) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_823) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'string' && /^[ ]?,[ ]?$/.test(options), this.getOptionName() + ' option requires string value containing only a comma and optional spaces' ); this._separator = options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'string' && /^[ ]?,[ ]?$/.test(options), |
| ✓ Was returned | typeof options === 'string' && /^[ ]?,[ ]?$/.test(options), |
| Function (anonymous_824) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateParameterSeparator'; }, |
| Function (anonymous_825) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var separators = this._separator.split(','); var whitespaceBeforeComma = Boolean(separators.shift()); var whitespaceAfterComma = Boolean(separators.pop()); file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { node.params.forEach(function(paramNode) { var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); }); } |
| Function (anonymous_826) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {··· node.params.forEach(function(paramNode) { var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); }); |
| Function (anonymous_827) | |
|---|---|
| ✓ Was called | node.params.forEach(function(paramNode) {··· var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (punctuatorToken.value === ',') {··· if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (whitespaceBeforeComma) {··· errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { |
| ✓ Negative was executed (else) | } else {··· errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (whitespaceAfterComma) {··· errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { |
| ✓ Negative was executed (else) | } else {··· errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } |
| Function (anonymous_828) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_829) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_830) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceBetweenArguments'; }, |
| Function (anonymous_831) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['CallExpression'], function(node) { node.arguments.forEach(function(param) { var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); }); } |
| Function (anonymous_832) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['CallExpression'], function(node) {··· node.arguments.forEach(function(param) { var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); }); |
| Function (anonymous_833) | |
|---|---|
| ✓ Was called | node.arguments.forEach(function(param) {··· var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (punctuatorToken.value === ',') {··· errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_834) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_835) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_836) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceBetweenArguments'; }, |
| Function (anonymous_837) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['CallExpression'], function(node) { node.arguments.forEach(function(param) { var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); }); } |
| Function (anonymous_838) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['CallExpression'], function(node) {··· node.arguments.forEach(function(param) { var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); }); |
| Function (anonymous_839) | |
|---|---|
| ✓ Was called | node.arguments.forEach(function(param) {··· var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (punctuatorToken.value === ',') {··· errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_840) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_841) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || Array.isArray(options.allExcept), this.getOptionName() + ' option requires a true value or an object of exceptions' ); this._allowedConstructors = {}; var allExcept = options.allExcept; if (allExcept) { for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || Array.isArray(options.allExcept), |
| ✓ Was returned | options === true || Array.isArray(options.allExcept), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (allExcept) {··· for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_842) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireCapitalizedConstructors'; }, |
| Function (anonymous_843) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var allowedConstructors = this._allowedConstructors; file.iterateNodesByType('NewExpression', function(node) { if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toUpperCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } }); } |
| Function (anonymous_844) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('NewExpression', function(node) {··· if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toUpperCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | node.callee.name[0].toUpperCase() !== node.callee.name[0] |
| ✓ Was returned | if (node.callee.type === 'Identifier' &&··· !allowedConstructors[node.callee.name] && |
| Branch LogicalExpression | |
| ✓ Was returned | !allowedConstructors[node.callee.name] && |
| ✓ Was returned | if (node.callee.type === 'Identifier' && |
| Function (anonymous_845) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_846) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· assert( Array.isArray(keywords) || typeof keywords === 'string', this.getOptionName() + ' option requires string or array value' ); this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(keywords) || typeof keywords === 'string', |
| ✓ Was returned | Array.isArray(keywords) || typeof keywords === 'string', |
| Function (anonymous_847) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'safeContextKeyword'; }, |
| Function (anonymous_848) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var keywords = typeof this._keywords === 'string' ? [this._keywords] : this._keywords; // var that = this file.iterateNodesByType('VariableDeclaration', function(node) { for (var i = 0; i < node.declarations.length; i++) { var decl = node.declarations[i]; // decl.init === null in case of "var foo;" if (decl.init && (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } } }); // that = this file.iterateNodesByType('AssignmentExpression', function(node) { if ( // filter property assignments "foo.bar = this" node.left.type === 'Identifier' && (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } }); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var keywords = typeof this._keywords === 'string' ? [this._keywords] : this._keywords; |
| ✓ Negative was returned (: ...) | var keywords = typeof this._keywords === 'string' ? [this._keywords] : this._keywords; |
| Function (anonymous_849) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('VariableDeclaration', function(node) {··· for (var i = 0; i < node.declarations.length; i++) { var decl = node.declarations[i]; // decl.init === null in case of "var foo;" if (decl.init && (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) |
| ✓ Was returned | if (decl.init && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) |
| ✓ Was returned | (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) |
| Function (anonymous_850) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('AssignmentExpression', function(node) {··· if ( // filter property assignments "foo.bar = this" node.left.type === 'Identifier' && (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) |
| ✓ Was returned | node.left.type === 'Identifier' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) |
| ✓ Was returned | (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) |
| Function checkKeywords | |
|---|---|
| ✓ Was called | function checkKeywords(name, keywords) {··· for (var i = 0; i < keywords.length; i++) { if (name === keywords[i]) { return false; } } return true; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (name === keywords[i]) {··· return false; } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_852) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_853) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'except_snake_case', this.getOptionName() + ' option requires a true value or "except_snake_case"' ); this._exceptSnakeCase = options === 'except_snake_case'; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options === true || options === 'except_snake_case', |
| ✓ Was returned | options === true || options === 'except_snake_case', |
| Function (anonymous_854) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireDotNotation'; }, |
| Function (anonymous_855) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var exceptSnakeCase = this._exceptSnakeCase; function isES3Allowed(value) { return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); } file.iterateNodesByType('MemberExpression', function(node) { if (!node.computed || node.property.type !== 'Literal') { return; } var value = node.property.value; if (typeof value === 'number' || (typeof value === 'string' && ( !utils.isValidIdentifierName(value) || exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) ))) { return; } if (value === null || typeof value === 'boolean' || value === 'null' || value === 'true' || value === 'false' || isES3Allowed(value) ) { return; } errors.add( 'Use dot notation instead of brackets for member expressions', node.property.loc.start ); }); } |
| Function isES3Allowed | |
|---|---|
| ✓ Was called | function isES3Allowed(value) {··· return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); |
| ✓ Was returned | return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); |
| Branch LogicalExpression | |
| ✓ Was returned | return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); |
| ✓ Was returned | return file.getDialect() === 'es3' && (utils.isEs3Keyword(value) || utils.isEs3FutureReservedWord(value)); |
| Function (anonymous_857) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('MemberExpression', function(node) {··· if (!node.computed || node.property.type !== 'Literal') { return; } var value = node.property.value; if (typeof value === 'number' || (typeof value === 'string' && ( !utils.isValidIdentifierName(value) || exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) ))) { return; } if (value === null || typeof value === 'boolean' || value === 'null' || value === 'true' || value === 'false' || isES3Allowed(value) ) { return; } errors.add( 'Use dot notation instead of brackets for member expressions', node.property.loc.start ); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!node.computed || node.property.type !== 'Literal') {··· return; } |
| ✓ Negative was executed (else) | }··· var value = node.property.value; |
| Branch LogicalExpression | |
| ✓ Was returned | if (!node.computed || node.property.type !== 'Literal') { |
| ✓ Was returned | if (!node.computed || node.property.type !== 'Literal') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ))) {··· return; } |
| ✓ Negative was executed (else) | }··· if (value === null || |
| Branch LogicalExpression | |
| ✓ Was returned | if (typeof value === 'number' || (typeof value === 'string' && (··· !utils.isValidIdentifierName(value) || exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) ))) { |
| ✓ Was returned | if (typeof value === 'number' || (typeof value === 'string' && ( |
| Branch LogicalExpression | |
| ✓ Was returned | !utils.isValidIdentifierName(value) ||··· exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) |
| ✓ Was returned | if (typeof value === 'number' || (typeof value === 'string' && ( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) |
| ✓ Was returned | !utils.isValidIdentifierName(value) || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) |
| ✓ Was returned | exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value)) |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ) {··· return; } |
| ✓ Negative was executed (else) | }··· errors.add( |
| Branch LogicalExpression | |
| ✓ Was returned | isES3Allowed(value) |
| ✓ Was returned | if (value === null ||··· typeof value === 'boolean' || value === 'null' || value === 'true' || value === 'false' || |
| Branch LogicalExpression | |
| ✓ Was returned | value === 'false' || |
| ✓ Was returned | if (value === null ||··· typeof value === 'boolean' || value === 'null' || value === 'true' || |
| Branch LogicalExpression | |
| ✓ Was returned | value === 'true' || |
| ✓ Was returned | if (value === null ||··· typeof value === 'boolean' || value === 'null' || |
| Branch LogicalExpression | |
| ✓ Was returned | value === 'null' || |
| ✓ Was returned | if (value === null ||··· typeof value === 'boolean' || |
| Branch LogicalExpression | |
| ✓ Was returned | typeof value === 'boolean' || |
| ✓ Was returned | if (value === null || |
| Function (anonymous_858) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_859) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || options === 'allowSlash' || typeof options === 'object', this.getOptionName() + ' option requires a true value ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof options !== 'object' || Array.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); // don't check triple slashed comments, microsoft js doc convention. see #593 // exceptions. see #592 // need to drop allowSlash support in 2.0. Fixes #697 this._allExcept = options === 'allowSlash' ? ['/'] : options.allExcept || []; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'object', |
| ✓ Was returned | options === true ||··· options === 'allowSlash' || |
| Branch LogicalExpression | |
| ✓ Was returned | options === 'allowSlash' || |
| ✓ Was returned | options === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(options.allExcept) &&··· typeof options.allExcept[0] === 'string', |
| ✓ Was returned | typeof options !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options.allExcept[0] === 'string', |
| ✗ Was not returned | Array.isArray(options.allExcept) && |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | this._allExcept = options === 'allowSlash' ? ['/'] : |
| ✓ Negative was returned (: ...) | options.allExcept || []; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | options.allExcept || []; |
| ✓ Was returned | options.allExcept || []; |
| Function (anonymous_860) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpaceAfterLineComment'; }, |
| Function (anonymous_861) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var allExcept = this._allExcept; file.iterateTokensByType('Line', function(comment) { var value = comment.value; // cutout exceptions allExcept.forEach(function(el) { if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); if (value.length === 0) { return; } if (value[0] !== ' ') { errors.add('Missing space after line comment', comment.loc.start); } }); } |
| Function (anonymous_862) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Line', function(comment) {··· var value = comment.value; // cutout exceptions allExcept.forEach(function(el) { if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); if (value.length === 0) { return; } if (value[0] !== ' ') { errors.add('Missing space after line comment', comment.loc.start); } }); |
| Function (anonymous_863) | |
|---|---|
| ✓ Was called | allExcept.forEach(function(el) {··· if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value.indexOf(el) === 0) {··· value = value.substr(el.length); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value.length === 0) {··· return; } |
| ✓ Negative was executed (else) | }··· if (value[0] !== ' ') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value[0] !== ' ') {··· errors.add('Missing space after line comment', comment.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_864) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_865) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_866) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpaceAfterLineComment'; }, |
| Function (anonymous_867) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByType('Line', function(comment) { var value = comment.value; if (value.length > 0 && value[0] === ' ') { errors.add('Illegal space after line comment', comment.loc.start); } }); } |
| Function (anonymous_868) | |
|---|---|
| ✓ Was called | file.iterateTokensByType('Line', function(comment) {··· var value = comment.value; if (value.length > 0 && value[0] === ' ') { errors.add('Illegal space after line comment', comment.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (value.length > 0 && value[0] === ' ') {··· errors.add('Illegal space after line comment', comment.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (value.length > 0 && value[0] === ' ') { |
| ✓ Was returned | if (value.length > 0 && value[0] === ' ') { |
| Function (anonymous_869) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_870) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_871) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireAnonymousFunctions'; }, |
| Function (anonymous_872) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) { if (node.id !== null) { errors.add('Functions must not be named', node.loc.start); } }); } |
| Function (anonymous_873) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) {··· if (node.id !== null) { errors.add('Functions must not be named', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id !== null) {··· errors.add('Functions must not be named', node.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_874) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_875) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_876) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowAnonymousFunctions'; }, |
| Function (anonymous_877) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) { if (node.id === null) { errors.add('Anonymous functions need to be named', node.loc.start); } }); } |
| Function (anonymous_878) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) {··· if (node.id === null) { errors.add('Anonymous functions need to be named', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id === null) {··· errors.add('Anonymous functions need to be named', node.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Function getNodeName | |
|---|---|
| ✓ Was called | function getNodeName(node) {··· if (node.type === 'Identifier') { return node.name; } else { return node.value; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'Identifier') {··· return node.name; } else { |
| ✓ Negative was executed (else) | } else {··· return node.value; } |
| Function (anonymous_880) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_881) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true || typeof options === 'object', this.getOptionName() + ' option requires true value ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof options !== 'object' || Array.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); if (options.allExcept) { this._allExceptItems = options.allExcept.map(function(item) { var parts = pathval.parse(item).map(function extractPart (part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options === 'object', |
| ✓ Was returned | options === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | Array.isArray(options.allExcept) &&··· typeof options.allExcept[0] === 'string', |
| ✓ Was returned | typeof options !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof options.allExcept[0] === 'string', |
| ✓ Was returned | Array.isArray(options.allExcept) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (options.allExcept) {··· this._allExceptItems = options.allExcept.map(function(item) { var parts = pathval.parse(item).map(function extractPart (part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); } |
| ✓ Negative was executed (else) | }··· }, |
| Function (anonymous_882) | |
|---|---|
| ✓ Was called | this._allExceptItems = options.allExcept.map(function(item) {··· var parts = pathval.parse(item).map(function extractPart (part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); |
| Function extractPart | |
|---|---|
| ✓ Was called | var parts = pathval.parse(item).map(function extractPart (part) {··· return part.i !== undefined ? part.i : part.p; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | return part.i !== undefined ? part.i : part.p; |
| ✓ Negative was returned (: ...) | return part.i !== undefined ? part.i : part.p; |
| Function (anonymous_884) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireNamedUnassignedFunctions'; }, |
| Function (anonymous_885) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var _this = this; file.iterateNodesByType('FunctionExpression', function(node) { var parentNode = node.parentNode; // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has been named, skip it // e.g. `[].forEach(function hello() {` if (node.id !== null) { return; } // If we have exceptions and the function is being invoked, detect whether we excepted it if (_this._allExceptItems && parentNode.type === 'CallExpression') { // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } // Complain that this function must be named errors.add('Inline functions need to be named', node.loc.start); }); } |
| Function (anonymous_886) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('FunctionExpression', function(node) {··· var parentNode = node.parentNode; // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has been named, skip it // e.g. `[].forEach(function hello() {` if (node.id !== null) { return; } // If we have exceptions and the function is being invoked, detect whether we excepted it if (_this._allExceptItems && parentNode.type === 'CallExpression') { // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } // Complain that this function must be named errors.add('Inline functions need to be named', node.loc.start); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) {··· return; } |
| ✓ Negative was executed (else) | }··· // If the function has been named, skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id !== null) {··· return; } |
| ✓ Negative was executed (else) | }··· // If we have exceptions and the function is being invoked, detect whether we excepted it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (_this._allExceptItems && parentNode.type === 'CallExpression') {··· // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } |
| ✓ Negative was executed (else) | }··· // Complain that this function must be named |
| Branch LogicalExpression | |
| ✓ Was returned | if (_this._allExceptItems && parentNode.type === 'CallExpression') { |
| ✓ Was returned | if (_this._allExceptItems && parentNode.type === 'CallExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (memberNode.type.match(/Identifier|Literal/)) {··· fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { |
| ✓ Negative was executed (else) | } else if (memberNode.type === 'MemberExpression') {··· fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | } else if (memberNode.type === 'MemberExpression') {··· fullpathParts.unshift(getNodeName(memberNode.property)); } else { |
| ✓ Negative was executed (else) | } else {··· canBeRepresented = false; break; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (canBeRepresented) {··· var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } |
| ✓ Negative was executed (else) | }··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (fullpath === _this._allExceptItems[i]) {··· return; } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_887) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_888) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires true value' ); }, |
| Function (anonymous_889) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowNamedUnassignedFunctions'; }, |
| Function (anonymous_890) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('FunctionExpression', function(node) { // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (node.parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has not been named, skip it // e.g. `[].forEach(function() {` if (node.id === null) { return; } // Otherwise, complain that it is being named errors.add('Inline functions cannot be named', node.loc.start); }); } |
| Function (anonymous_891) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('FunctionExpression', function(node) {··· // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (node.parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has not been named, skip it // e.g. `[].forEach(function() {` if (node.id === null) { return; } // Otherwise, complain that it is being named errors.add('Inline functions cannot be named', node.loc.start); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) {··· return; } |
| ✓ Negative was executed (else) | }··· // If the function has not been named, skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.id === null) {··· return; } |
| ✓ Negative was executed (else) | }··· // Otherwise, complain that it is being named |
| Function (anonymous_892) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_893) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_894) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireFunctionDeclarations'; }, |
| Function (anonymous_895) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType( 'VariableDeclarator', function(node) { if (node.init && node.init.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } ); file.iterateNodesByType( 'AssignmentExpression', function(node) { if (node.left.type !== 'MemberExpression' && node.right.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } ); } |
| Function (anonymous_896) | |
|---|---|
| ✓ Was called | function(node) {··· if (node.init && node.init.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.init && node.init.type === 'FunctionExpression') {··· errors.add('Use a function declaration instead', node.loc.start); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.init && node.init.type === 'FunctionExpression') { |
| ✓ Was returned | if (node.init && node.init.type === 'FunctionExpression') { |
| Function (anonymous_897) | |
|---|---|
| ✓ Was called | function(node) {··· if (node.left.type !== 'MemberExpression' && node.right.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.right.type === 'FunctionExpression') {··· errors.add('Use a function declaration instead', node.loc.start); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | node.right.type === 'FunctionExpression') { |
| ✓ Was returned | if (node.left.type !== 'MemberExpression' && |
| Function (anonymous_898) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_899) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_900) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowFunctionDeclarations'; }, |
| Function (anonymous_901) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('FunctionDeclaration', function(node) { errors.add('Illegal function declaration', node.loc.start); }); } |
| Function (anonymous_902) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('FunctionDeclaration', function(node) {··· errors.add('Illegal function declaration', node.loc.start); }); |
| Function (anonymous_903) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_904) | |
|---|---|
| ✓ Was called | configure: function(options) {··· // except comments that begin with `jscs`, since these are used to // selectively enable/disable rules within a file this._exceptions = { 'jscs': true }; var optionName = this.getOptionName(); var isObject = typeof options === 'object'; assert( options === true || isObject, optionName + ' option requires a true value ' + 'or an object with String[] `allExcept` property' ); if (isObject) { var exceptions = options.allExcept; // verify items in `allExcept` property in object are string values assert( Array.isArray(exceptions) && exceptions.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); for (var i = 0, l = exceptions.length; i < l; i++) { this._exceptions[exceptions[i]] = true; } } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | isObject, |
| ✓ Was returned | options === true || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (isObject) {··· var exceptions = options.allExcept; // verify items in `allExcept` property in object are string values assert( Array.isArray(exceptions) && exceptions.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); for (var i = 0, l = exceptions.length; i < l; i++) { this._exceptions[exceptions[i]] = true; } } |
| ✓ Negative was executed (else) | }··· }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | exceptions.every(function(el) { return typeof el === 'string'; }), |
| ✗ Was not returned | Array.isArray(exceptions) && |
| Function (anonymous_905) | |
|---|---|
| ✓ Was called | exceptions.every(function(el) { return typeof el === 'string'; }), |
| Function (anonymous_906) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireCapitalizedComments'; }, |
| Function (anonymous_907) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var inTextBlock = null; var exceptions = this._exceptions; var letterPattern = require('../../patterns/L'); var upperCasePattern = require('../../patterns/Lu'); file.iterateTokensByType(['Line', 'Block'], function(comment, index, comments) { // strip leading whitespace and any asterisks // split on whitespace and colons var splitComment = comment.value.replace(/(^\s+|[\*])/g, '').split(/[\s\:]/g); if (exceptions[splitComment[0]]) { return; } var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; var isLetter = firstChar && letterPattern.test(firstChar); if (!isLetter) { inTextBlock = false; return; } inTextBlock = inTextBlock && comments[index - 1].type === 'Line' && comments[index - 1].loc.start.line + 1 === comment.loc.start.line; var isUpperCase = upperCasePattern.test(firstChar); var isValid = isUpperCase || inTextBlock; if (!isValid) { errors.add( 'Comments must start with an uppercase letter, unless it is part of a textblock', comment.loc.start ); } inTextBlock = comment.type === 'Line'; }); } |
| Function (anonymous_908) | |
|---|---|
| ✓ Was called | file.iterateTokensByType(['Line', 'Block'], function(comment, index, comments) {··· // strip leading whitespace and any asterisks // split on whitespace and colons var splitComment = comment.value.replace(/(^\s+|[\*])/g, '').split(/[\s\:]/g); if (exceptions[splitComment[0]]) { return; } var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; var isLetter = firstChar && letterPattern.test(firstChar); if (!isLetter) { inTextBlock = false; return; } inTextBlock = inTextBlock && comments[index - 1].type === 'Line' && comments[index - 1].loc.start.line + 1 === comment.loc.start.line; var isUpperCase = upperCasePattern.test(firstChar); var isValid = isUpperCase || inTextBlock; if (!isValid) { errors.add( 'Comments must start with an uppercase letter, unless it is part of a textblock', comment.loc.start ); } inTextBlock = comment.type === 'Line'; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (exceptions[splitComment[0]]) {··· return; } |
| ✓ Negative was executed (else) | }··· var stripped = comment.value.replace(/[\n\s\*]/g, ''); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var isLetter = firstChar && letterPattern.test(firstChar); |
| ✓ Was returned | var isLetter = firstChar && letterPattern.test(firstChar); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isLetter) {··· inTextBlock = false; return; } |
| ✓ Negative was executed (else) | }··· inTextBlock = inTextBlock && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | comments[index - 1].loc.start.line + 1 === comment.loc.start.line; |
| ✓ Was returned | inTextBlock = inTextBlock &&··· comments[index - 1].type === 'Line' && |
| Branch LogicalExpression | |
| ✓ Was returned | comments[index - 1].type === 'Line' && |
| ✓ Was returned | inTextBlock = inTextBlock && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var isValid = isUpperCase || inTextBlock; |
| ✓ Was returned | var isValid = isUpperCase || inTextBlock; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!isValid) {··· errors.add( 'Comments must start with an uppercase letter, unless it is part of a textblock', comment.loc.start ); } |
| ✓ Negative was executed (else) | }··· inTextBlock = comment.type === 'Line'; |
| Function (anonymous_909) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_910) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_911) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowCapitalizedComments'; }, |
| Function (anonymous_912) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var letterPattern = require('../../patterns/L'); var lowerCasePattern = require('../../patterns/Ll'); file.iterateTokensByType(['Line', 'Block'], function(comment) { var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } }); } |
| Function (anonymous_913) | |
|---|---|
| ✓ Was called | file.iterateTokensByType(['Line', 'Block'], function(comment) {··· var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) {··· errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { |
| ✓ Was returned | if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { |
| Function (anonymous_914) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_915) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_916) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireLineBreakAfterVariableAssignment'; }, |
| Function (anonymous_917) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var lastDeclaration; file.iterateNodesByType('VariableDeclaration', function(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var' || thisDeclaration.parentNode.kind === 'let' || thisDeclaration.parentNode.kind === 'const') { if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } } }); } |
| Function (anonymous_918) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('VariableDeclaration', function(node) {··· if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var' || thisDeclaration.parentNode.kind === 'let' || thisDeclaration.parentNode.kind === 'const') { if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.parentNode.type === 'ForOfStatement') {··· return; } |
| ✓ Negative was executed (else) | }··· for (var i = 0; i < node.declarations.length; i++) { |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type === 'ForOfStatement') { |
| ✓ Was returned | if (node.parentNode.type === 'ForStatement' ||··· node.parentNode.type === 'ForInStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type === 'ForInStatement' || |
| ✓ Was returned | if (node.parentNode.type === 'ForStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | thisDeclaration.parentNode.kind === 'const') {··· if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } |
| ✗ Negative was not executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | thisDeclaration.parentNode.kind === 'const') { |
| ✓ Was returned | if (thisDeclaration.parentNode.kind === 'var' ||··· thisDeclaration.parentNode.kind === 'let' || |
| Branch LogicalExpression | |
| ✓ Was returned | thisDeclaration.parentNode.kind === 'let' || |
| ✓ Was returned | if (thisDeclaration.parentNode.kind === 'var' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (lastDeclaration && lastDeclaration.init) {··· errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } |
| ✓ Negative was executed (else) | }··· lastDeclaration = thisDeclaration; |
| Branch LogicalExpression | |
| ✓ Was returned | if (lastDeclaration && lastDeclaration.init) { |
| ✓ Was returned | if (lastDeclaration && lastDeclaration.init) { |
| Function (anonymous_919) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_920) | |
|---|---|
| ✓ Was called | configure: function(requirePaddingNewLineAfterVariableDeclaration) {··· assert( requirePaddingNewLineAfterVariableDeclaration === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_921) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLineAfterVariableDeclaration'; }, |
| Function (anonymous_922) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('VariableDeclaration', function(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } var endOfDeclaration = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfDeclaration); if (nextToken.value in {'var': true, 'let': true, 'const': true}) { return; } if (nextToken.value === '}') { return; } if (nextToken.type === 'EOF') { return; } errors.assert.linesBetween({ atLeast: 2, token: endOfDeclaration, nextToken: nextToken }); }); } |
| Function (anonymous_923) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('VariableDeclaration', function(node) {··· if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } var endOfDeclaration = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfDeclaration); if (nextToken.value in {'var': true, 'let': true, 'const': true}) { return; } if (nextToken.value === '}') { return; } if (nextToken.type === 'EOF') { return; } errors.assert.linesBetween({ atLeast: 2, token: endOfDeclaration, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | node.parentNode.type === 'ForOfStatement') {··· return; } |
| ✓ Negative was executed (else) | }··· var endOfDeclaration = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type === 'ForOfStatement') { |
| ✓ Was returned | if (node.parentNode.type === 'ForStatement' ||··· node.parentNode.type === 'ForInStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | node.parentNode.type === 'ForInStatement' || |
| ✓ Was returned | if (node.parentNode.type === 'ForStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.value in {'var': true, 'let': true, 'const': true}) {··· return; } |
| ✓ Negative was executed (else) | }··· if (nextToken.value === '}') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.value === '}') {··· return; } |
| ✓ Negative was executed (else) | }··· if (nextToken.type === 'EOF') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'EOF') {··· return; } |
| ✓ Negative was executed (else) | }··· errors.assert.linesBetween({ |
| Function (anonymous_924) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_925) | |
|---|---|
| ✓ Was called | configure: function(disallowPaddingNewLinesAfterUseStrict) {··· assert( disallowPaddingNewLinesAfterUseStrict === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_926) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewLinesAfterUseStrict'; }, |
| Function (anonymous_927) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ExpressionStatement', function(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atMost: 1, token: endOfNode, nextToken: nextToken }); }); } |
| Function (anonymous_928) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ExpressionStatement', function(node) {··· var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atMost: 1, token: endOfNode, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression.type !== 'Literal' || expression.value !== 'use strict') {··· return; } |
| ✓ Negative was executed (else) | }··· var endOfNode = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | if (expression.type !== 'Literal' || expression.value !== 'use strict') { |
| ✓ Was returned | if (expression.type !== 'Literal' || expression.value !== 'use strict') { |
| Function (anonymous_929) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_930) | |
|---|---|
| ✓ Was called | configure: function(requirePaddingNewLinesAfterUseStrict) {··· assert( requirePaddingNewLinesAfterUseStrict === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_931) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLinesAfterUseStrict'; }, |
| Function (anonymous_932) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ExpressionStatement', function(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atLeast: 2, token: endOfNode, nextToken: nextToken }); }); } |
| Function (anonymous_933) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ExpressionStatement', function(node) {··· var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atLeast: 2, token: endOfNode, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (expression.type !== 'Literal' || expression.value !== 'use strict') {··· return; } |
| ✓ Negative was executed (else) | }··· var endOfNode = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | if (expression.type !== 'Literal' || expression.value !== 'use strict') { |
| ✓ Was returned | if (expression.type !== 'Literal' || expression.value !== 'use strict') { |
| Function (anonymous_934) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_935) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_936) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowPaddingNewLinesBeforeExport'; }, |
| Function (anonymous_937) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('AssignmentExpression', function(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken, {includeComments: true}); errors.assert.linesBetween({ atMost: 1, token: prevToken, nextToken: firstToken, message: 'Unexpected extra newline before export' }); }); } |
| Function (anonymous_938) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('AssignmentExpression', function(node) {··· var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken, {includeComments: true}); errors.assert.linesBetween({ atMost: 1, token: prevToken, nextToken: firstToken, message: 'Unexpected extra newline before export' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | left.property.name === 'exports')) {··· return; } |
| ✓ Negative was executed (else) | }··· var firstToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | left.property.name === 'exports')) { |
| ✓ Was returned | left.object &&··· left.object.name === 'module' && left.property && |
| Branch LogicalExpression | |
| ✓ Was returned | left.property && |
| ✓ Was returned | left.object &&··· left.object.name === 'module' && |
| Branch LogicalExpression | |
| ✓ Was returned | left.object.name === 'module' && |
| ✗ Was not returned | left.object && |
| Function (anonymous_939) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_940) | |
|---|---|
| ✓ Was called | configure: function(value) {··· assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_941) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requirePaddingNewLinesBeforeExport'; }, |
| Function (anonymous_942) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('AssignmentExpression', function(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken); errors.assert.linesBetween({ atLeast: 2, token: prevToken, nextToken: firstToken, message: 'Missing newline before export' }); }); } |
| Function (anonymous_943) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('AssignmentExpression', function(node) {··· var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken); errors.assert.linesBetween({ atLeast: 2, token: prevToken, nextToken: firstToken, message: 'Missing newline before export' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | left.property.name === 'exports')) {··· return; } |
| ✓ Negative was executed (else) | }··· var firstToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | left.property.name === 'exports')) { |
| ✓ Was returned | left.object &&··· left.object.name === 'module' && left.property && |
| Branch LogicalExpression | |
| ✓ Was returned | left.property && |
| ✓ Was returned | left.object &&··· left.object.name === 'module' && |
| Branch LogicalExpression | |
| ✓ Was returned | left.object.name === 'module' && |
| ✗ Was not returned | left.object && |
| Function (anonymous_944) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_945) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_946) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSemicolons'; }, |
| Function (anonymous_947) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType([ 'VariableDeclaration', 'ExpressionStatement', 'DoWhileStatement', 'ReturnStatement', 'ThrowStatement', 'BreakStatement', 'ContinueStatement', 'DebuggerStatement' ], function(node) { // ignore variable declaration inside for and for-in if (node.type === 'VariableDeclaration') { if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } // get last token inside node var lastToken = file.getLastNodeToken(node); var checkToken = lastToken; // if last token is not a semicolon punctuator, try to get next token in file if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { checkToken = file.getNextToken(checkToken); } // check token is semicolon if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { errors.add( 'Missing semicolon after statement', (lastToken || node).loc.end ); } }); } |
| Function (anonymous_948) | |
|---|---|
| ✓ Was called | ], function(node) {··· // ignore variable declaration inside for and for-in if (node.type === 'VariableDeclaration') { if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } // get last token inside node var lastToken = file.getLastNodeToken(node); var checkToken = lastToken; // if last token is not a semicolon punctuator, try to get next token in file if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { checkToken = file.getNextToken(checkToken); } // check token is semicolon if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { errors.add( 'Missing semicolon after statement', (lastToken || node).loc.end ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'VariableDeclaration') {··· if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } |
| ✓ Negative was executed (else) | }··· // get last token inside node |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) {··· return; } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { |
| ✓ Was returned | if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) ||··· (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
| ✓ Was returned | (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| ✓ Was returned | if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
| ✓ Was returned | if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || |
| ✓ Was returned | if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| ✓ Was returned | (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { |
| ✓ Was returned | (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) {··· checkToken = file.getNextToken(checkToken); } |
| ✓ Negative was executed (else) | }··· // check token is semicolon |
| Branch LogicalExpression | |
| ✓ Was returned | if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| ✓ Was returned | if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| ✓ Was returned | if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') {··· errors.add( 'Missing semicolon after statement', (lastToken || node).loc.end ); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| ✓ Was returned | if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| ✓ Was returned | if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | (lastToken || node).loc.end |
| ✓ Was returned | (lastToken || node).loc.end |
| Function (anonymous_949) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_950) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_951) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSemicolons'; }, |
| Function (anonymous_952) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByTypeAndValue('Punctuator', ';', function(token) { var nextToken = file.getNextToken(token); // do not use assertions here as this is not yet autofixable if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { errors.add('semicolons are disallowed at the end of a line.', token.loc.end); } }); } |
| Function (anonymous_953) | |
|---|---|
| ✓ Was called | file.iterateTokensByTypeAndValue('Punctuator', ';', function(token) {··· var nextToken = file.getNextToken(token); // do not use assertions here as this is not yet autofixable if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { errors.add('semicolons are disallowed at the end of a line.', token.loc.end); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) {··· errors.add('semicolons are disallowed at the end of a line.', token.loc.end); } |
| ✓ Negative was executed (else) | }··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { |
| ✓ Was returned | if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { |
| Function (anonymous_954) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_955) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_956) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'requireSpacesInForStatement'; }, |
| Function (anonymous_957) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ForStatement', function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.spacesBetween({ token: file.getPrevToken(testToken), nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } }); } |
| Function (anonymous_958) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ForStatement', function(node) {··· if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.spacesBetween({ token: file.getPrevToken(testToken), nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.test) {··· var testToken = file.getFirstNodeToken(node.test); errors.assert.spacesBetween({ token: file.getPrevToken(testToken), nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } |
| ✓ Negative was executed (else) | }··· if (node.update) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.update) {··· var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_959) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_960) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_961) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowSpacesInForStatement'; }, |
| Function (anonymous_962) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateNodesByType('ForStatement', function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } }); } |
| Function (anonymous_963) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('ForStatement', function(node) {··· if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.test) {··· var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } |
| ✓ Negative was executed (else) | }··· if (node.update) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.update) {··· var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function getCommentErrors | |
|---|---|
| ✓ Was called | function getCommentErrors(comment, keywordRegEx) {··· var splitComment = comment.value.split('\n'); var errors = []; splitComment.forEach(function(commentNode, index) { var lineIndex = index; var matches = commentNode.match(keywordRegEx); var lastIndex = -1; if (!matches) { return; } errors = errors.concat(matches.map(function(match) { lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); }); return errors; } |
| Function (anonymous_965) | |
|---|---|
| ✓ Was called | splitComment.forEach(function(commentNode, index) {··· var lineIndex = index; var matches = commentNode.match(keywordRegEx); var lastIndex = -1; if (!matches) { return; } errors = errors.concat(matches.map(function(match) { lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!matches) { return; } |
| ✓ Negative was executed (else) | if (!matches) { return; }··· errors = errors.concat(matches.map(function(match) { |
| Function (anonymous_966) | |
|---|---|
| ✓ Was called | errors = errors.concat(matches.map(function(match) {··· lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | column: lastIndex + (lineIndex > 0 ? 0 : 2) |
| ✓ Negative was returned (: ...) | column: lastIndex + (lineIndex > 0 ? 0 : 2) |
| Function (anonymous_967) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_968) | |
|---|---|
| ✓ Was called | configure: function(keywords) {··· this._message = 'Comments cannot contain the following keywords: '; this._keywords = ['todo', 'fixme']; switch (true) { case Array.isArray(keywords): // use the array of strings provided to build RegExp pattern this._keywords = keywords; /* falls through */ case keywords: // use default keywords this._message += this._keywords.join(', '); this._keywordRegEx = new RegExp('\\b(' + this._keywords.join('|') + ')\\b', 'gi'); break; case typeof keywords === 'string': // use string passed in as the RegExp pattern this._message = 'Comments cannot contain keywords based on the expression you provided'; this._keywordRegEx = new RegExp(keywords, 'gi'); break; default: assert(false, this.getOptionName() + ' option requires a true value, a string or an array'); } }, |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | case Array.isArray(keywords):··· // use the array of strings provided to build RegExp pattern this._keywords = keywords; |
| ✓ Was evaluated | case keywords:··· // use default keywords this._message += this._keywords.join(', '); this._keywordRegEx = new RegExp('\\b(' + this._keywords.join('|') + ')\\b', 'gi'); break; |
| ✓ Was evaluated | case typeof keywords === 'string':··· // use string passed in as the RegExp pattern this._message = 'Comments cannot contain keywords based on the expression you provided'; this._keywordRegEx = new RegExp(keywords, 'gi'); break; |
| ✓ Was evaluated | default:··· assert(false, this.getOptionName() + ' option requires a true value, a string or an array'); |
| Function (anonymous_969) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowKeywordsInComments'; }, |
| Function (anonymous_970) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· file.iterateTokensByType(['Line', 'Block'], function(comment) { getCommentErrors(comment, this._keywordRegEx).forEach(function(errorObj) { errors.add(this._message, errorObj); }.bind(this)); }.bind(this)); } |
| Function (anonymous_971) | |
|---|---|
| ✓ Was called | file.iterateTokensByType(['Line', 'Block'], function(comment) {··· getCommentErrors(comment, this._keywordRegEx).forEach(function(errorObj) { errors.add(this._message, errorObj); }.bind(this)); }.bind(this)); |
| Function (anonymous_972) | |
|---|---|
| ✓ Was called | getCommentErrors(comment, this._keywordRegEx).forEach(function(errorObj) {··· errors.add(this._message, errorObj); }.bind(this)); |
| Function (anonymous_973) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_974) | |
|---|---|
| ✓ Was called | configure: function(identifiers) {··· assert( Array.isArray(identifiers), 'disallowIdentifierNames option requires an array' ); this._identifierIndex = {}; for (var i = 0, l = identifiers.length; i < l; i++) { this._identifierIndex[identifiers[i]] = true; } }, |
| Function (anonymous_975) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowIdentifierNames'; }, |
| Function (anonymous_976) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var disallowedIdentifiers = this._identifierIndex; file.iterateNodesByType('Identifier', function(node) { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.name)) { errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } }); file.iterateNodesByType('MemberExpression', function(node) { if (node.property.type === 'Literal') { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } }); } |
| Function (anonymous_977) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('Identifier', function(node) {··· if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.name)) { errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.name)) {··· errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_978) | |
|---|---|
| ✓ Was called | file.iterateNodesByType('MemberExpression', function(node) {··· if (node.property.type === 'Literal') { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.property.type === 'Literal') {··· if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } |
| ✓ Negative was executed (else) | }··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) {··· errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } |
| ✓ Negative was executed (else) | }··· } |
| Function (anonymous_979) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_980) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( typeof options === 'number', this.getOptionName() + ' option requires number value or should be removed' ); this._maximumNumberOfLines = options; }, |
| Function (anonymous_981) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'maximumNumberOfLines'; }, |
| Function (anonymous_982) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var firstToken = file.getFirstToken(); var lastToken = file.getLastToken(); errors.assert.linesBetween({ token: firstToken, nextToken: lastToken, atMost: this._maximumNumberOfLines - 1, message: 'File must be at most ' + this._maximumNumberOfLines + ' lines long' }); } |
| Function (anonymous_983) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_984) | |
|---|---|
| ✓ Was called | configure: function(opts) {··· assert( opts === true || typeof opts === 'number' && opts >= 1 || typeof opts === 'object', this.getOptionName() + ' option requires maximal number of items ' + 'or true value either should be removed' ); if (typeof opts === 'object') { this._options = opts; if ('maximum' in opts) { assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); } else { opts.maximum = Infinity; } if ('ignoreBrackets' in opts) { assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); } else { opts.ignoreBrackets = false; } } else { this._options = { maximum: opts === true ? Infinity : opts, ignoreBrackets: false }; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof opts === 'object', |
| ✓ Was returned | opts === true ||··· typeof opts === 'number' && opts >= 1 || |
| Branch LogicalExpression | |
| ✓ Was returned | typeof opts === 'number' && opts >= 1 || |
| ✓ Was returned | opts === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | typeof opts === 'number' && opts >= 1 || |
| ✓ Was returned | typeof opts === 'number' && opts >= 1 || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (typeof opts === 'object') {··· this._options = opts; if ('maximum' in opts) { assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); } else { opts.maximum = Infinity; } if ('ignoreBrackets' in opts) { assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); } else { opts.ignoreBrackets = false; } } else { |
| ✓ Negative was executed (else) | } else {··· this._options = { maximum: opts === true ? Infinity : opts, ignoreBrackets: false }; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('maximum' in opts) {··· assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); } else { |
| ✓ Negative was executed (else) | } else {··· opts.maximum = Infinity; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | assert(typeof opts.maximum === 'number' && opts.maximum >= 1, |
| ✓ Was returned | assert(typeof opts.maximum === 'number' && opts.maximum >= 1, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if ('ignoreBrackets' in opts) {··· assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); } else { |
| ✓ Negative was executed (else) | } else {··· opts.ignoreBrackets = false; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | maximum: opts === true ? Infinity : opts, |
| ✓ Negative was returned (: ...) | maximum: opts === true ? Infinity : opts, |
| Function (anonymous_985) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'validateNewlineAfterArrayElements'; }, |
| Function (anonymous_986) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· var maximum = this._options.maximum; var ignoreBrackets = this._options.ignoreBrackets; file.iterateNodesByType(['ArrayExpression'], function(node) { var els = node.elements; if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { return; } if (!ignoreBrackets) { if (els[0] && els[0].loc.start.line === node.loc.start.line) { errors.add('First element should be placed on new line', els[0].loc.start); } if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { errors.add('Closing bracket should be placed on new line', node.loc.end); } } var prevLine = 0; els.forEach(function(elem) { if (!elem) { // skip holes return; } var line = elem.loc.start.line; if (prevLine === line) { errors.add('Multiple elements at a single line in multiline array', { line: line, column: elem.loc.start.column }); } prevLine = line; }); }); } |
| Function (anonymous_987) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['ArrayExpression'], function(node) {··· var els = node.elements; if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { return; } if (!ignoreBrackets) { if (els[0] && els[0].loc.start.line === node.loc.start.line) { errors.add('First element should be placed on new line', els[0].loc.start); } if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { errors.add('Closing bracket should be placed on new line', node.loc.end); } } var prevLine = 0; els.forEach(function(elem) { if (!elem) { // skip holes return; } var line = elem.loc.start.line; if (prevLine === line) { errors.add('Multiple elements at a single line in multiline array', { line: line, column: elem.loc.start.column }); } prevLine = line; }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (els.length <= maximum && node.loc.start.line === node.loc.end.line) {··· return; } |
| ✓ Negative was executed (else) | }··· if (!ignoreBrackets) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { |
| ✓ Was returned | if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!ignoreBrackets) {··· if (els[0] && els[0].loc.start.line === node.loc.start.line) { errors.add('First element should be placed on new line', els[0].loc.start); } if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { errors.add('Closing bracket should be placed on new line', node.loc.end); } } |
| ✓ Negative was executed (else) | }··· var prevLine = 0; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (els[0] && els[0].loc.start.line === node.loc.start.line) {··· errors.add('First element should be placed on new line', els[0].loc.start); } |
| ✓ Negative was executed (else) | }··· if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (els[0] && els[0].loc.start.line === node.loc.start.line) { |
| ✓ Was returned | if (els[0] && els[0].loc.start.line === node.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) {··· errors.add('Closing bracket should be placed on new line', node.loc.end); } |
| ✓ Negative was executed (else) | }··· } |
| Branch LogicalExpression | |
| ✓ Was returned | if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { |
| ✓ Was returned | if (els[els.length - 1] && els[els.length - 1].loc.end.line === node.loc.end.line) { |
| Function (anonymous_988) | |
|---|---|
| ✓ Was called | els.forEach(function(elem) {··· if (!elem) { // skip holes return; } var line = elem.loc.start.line; if (prevLine === line) { errors.add('Multiple elements at a single line in multiline array', { line: line, column: elem.loc.start.column }); } prevLine = line; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!elem) {··· // skip holes return; } |
| ✓ Negative was executed (else) | }··· var line = elem.loc.start.line; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (prevLine === line) {··· errors.add('Multiple elements at a single line in multiline array', { line: line, column: elem.loc.start.column }); } |
| ✓ Negative was executed (else) | }··· prevLine = line; |
| Function (anonymous_989) | |
|---|---|
| ✓ Was called | module.exports = function() {}; |
| Function (anonymous_990) | |
|---|---|
| ✓ Was called | configure: function(options) {··· assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_991) | |
|---|---|
| ✓ Was called | getOptionName: function() {··· return 'disallowNotOperatorsInConditionals'; }, |
| Function (anonymous_992) | |
|---|---|
| ✓ Was called | check: function(file, errors) {··· function hasNotOperator(test) { return test.type === 'UnaryExpression' && test.operator === '!'; } function hasNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!='; } function hasStrictNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!=='; } file.iterateNodesByType(['IfStatement', 'ConditionalExpression'], function(node) { var alternate = node.alternate; // check if the if statement has an else block if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { return; } var test = node.test; if (hasNotOperator(test)) { errors.add('Illegal use of not operator in if statement', test.loc.start); } if (hasNotEqualOperator(test)) { errors.add('Illegal use of not equal operator in if statement', test.loc.end); } if (hasStrictNotEqualOperator(test)) { errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } }); } |
| Function hasNotOperator | |
|---|---|
| ✓ Was called | function hasNotOperator(test) {··· return test.type === 'UnaryExpression' && test.operator === '!'; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return test.type === 'UnaryExpression' && test.operator === '!'; |
| ✓ Was returned | return test.type === 'UnaryExpression' && test.operator === '!'; |
| Function hasNotEqualOperator | |
|---|---|
| ✓ Was called | function hasNotEqualOperator(test) {··· return test.type === 'BinaryExpression' && test.operator === '!='; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return test.type === 'BinaryExpression' && test.operator === '!='; |
| ✓ Was returned | return test.type === 'BinaryExpression' && test.operator === '!='; |
| Function hasStrictNotEqualOperator | |
|---|---|
| ✓ Was called | function hasStrictNotEqualOperator(test) {··· return test.type === 'BinaryExpression' && test.operator === '!=='; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | return test.type === 'BinaryExpression' && test.operator === '!=='; |
| ✓ Was returned | return test.type === 'BinaryExpression' && test.operator === '!=='; |
| Function (anonymous_996) | |
|---|---|
| ✓ Was called | file.iterateNodesByType(['IfStatement', 'ConditionalExpression'], function(node) {··· var alternate = node.alternate; // check if the if statement has an else block if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { return; } var test = node.test; if (hasNotOperator(test)) { errors.add('Illegal use of not operator in if statement', test.loc.start); } if (hasNotEqualOperator(test)) { errors.add('Illegal use of not equal operator in if statement', test.loc.end); } if (hasStrictNotEqualOperator(test)) { errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) {··· return; } |
| ✓ Negative was executed (else) | }··· var test = node.test; |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { |
| ✓ Was returned | if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { |
| Branch LogicalExpression | |
| ✓ Was returned | if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { |
| ✓ Was returned | if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hasNotOperator(test)) {··· errors.add('Illegal use of not operator in if statement', test.loc.start); } |
| ✓ Negative was executed (else) | }··· if (hasNotEqualOperator(test)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hasNotEqualOperator(test)) {··· errors.add('Illegal use of not equal operator in if statement', test.loc.end); } |
| ✓ Negative was executed (else) | }··· if (hasStrictNotEqualOperator(test)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (hasStrictNotEqualOperator(test)) {··· errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_997) | |
|---|---|
| ✓ Was called | module.exports = function(errorsCollection) {··· var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } }); if (errorCount) { /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } else { console.log('No code style errors found.'); } }; |
| Function (anonymous_998) | |
|---|---|
| ✓ Was called | errorsCollection.forEach(function(errors) {··· if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!errors.isEmpty()) {··· /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_999) | |
|---|---|
| ✓ Was called | errors.getErrorList().forEach(function(error) {··· errorCount++; console.log(errors.explainError(error, true) + '\n'); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errorCount) {··· /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } else { |
| ✓ Negative was executed (else) | } else {··· console.log('No code style errors found.'); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); |
| ✓ Negative was returned (: ...) | console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); |
| Function (anonymous_1000) | |
|---|---|
| ✓ Was called | module.exports = function(errorsCollection) {··· var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } }); }; |
| Function (anonymous_1001) | |
|---|---|
| ✓ Was called | errorsCollection.forEach(function(errors) {··· var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!errors.isEmpty()) {··· errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_1002) | |
|---|---|
| ✓ Was called | errors.getErrorList().forEach(function(error) {··· errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); |
| Function (anonymous_1003) | |
|---|---|
| ✓ Was called | module.exports = function(errorsCollection) {··· errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } }); }; |
| Function (anonymous_1004) | |
|---|---|
| ✓ Was called | errorsCollection.forEach(function(errors) {··· if (!errors.isEmpty()) { var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!errors.isEmpty()) {··· var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_1005) | |
|---|---|
| ✓ Was called | var out = errors.getErrorList().map(function(error) {··· return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); |
| Function (anonymous_1006) | |
|---|---|
| ✓ Was called | module.exports = function(errorCollection) {··· var i = 0; var testsuite = xml.create('testsuite'); testsuite.att('name', 'JSCS'); testsuite.att('tests', errorCollection.length); errorCollection.forEach(function(errors) { var errorsCount = errors.getErrorCount(); var testcase = testsuite.ele('testcase', { name: errors.getFilename(), failures: errorsCount }); i += errorsCount; errors.getErrorList().forEach(function(error) { testcase.ele('failure', {}, errors.explainError(error)); }); }); testsuite.att('failures', i); console.log(testsuite.end({pretty: true})); }; |
| Function (anonymous_1007) | |
|---|---|
| ✓ Was called | errorCollection.forEach(function(errors) {··· var errorsCount = errors.getErrorCount(); var testcase = testsuite.ele('testcase', { name: errors.getFilename(), failures: errorsCount }); i += errorsCount; errors.getErrorList().forEach(function(error) { testcase.ele('failure', {}, errors.explainError(error)); }); }); |
| Function (anonymous_1008) | |
|---|---|
| ✓ Was called | errors.getErrorList().forEach(function(error) {··· testcase.ele('failure', {}, errors.explainError(error)); }); |
| Function (anonymous_1009) | |
|---|---|
| ✓ Was called | module.exports = function(errorsCollection) {··· var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } }); if (errorCount) { /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } else { console.log('No code style errors found.'); } }; |
| Function (anonymous_1010) | |
|---|---|
| ✓ Was called | errorsCollection.forEach(function(errors) {··· if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (!errors.isEmpty()) {··· /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } |
| ✓ Negative was executed (else) | }··· }); |
| Function (anonymous_1011) | |
|---|---|
| ✓ Was called | errors.getErrorList().forEach(function(error) {··· errorCount++; console.log(errors.explainError(error) + '\n'); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | if (errorCount) {··· /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } else { |
| ✓ Negative was executed (else) | } else {··· console.log('No code style errors found.'); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); |
| ✓ Negative was returned (: ...) | console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); |